Page MenuHomePhabricator

Don't compute MIME type of noninitial chunks from `diffusion.filecontentquery`
ClosedPublic

Authored by epriestley on Jun 19 2017, 9:45 PM.
Tags
None
Referenced Files
F17796492: D18138.id.diff
Fri, Jul 25, 1:00 AM
F17750254: D18138.diff
Tue, Jul 22, 3:01 AM
F17749904: D18138.diff
Tue, Jul 22, 2:24 AM
Unknown Object (File)
Wed, Jul 2, 5:12 AM
Unknown Object (File)
Jun 19 2025, 1:45 PM
Unknown Object (File)
Jun 18 2025, 11:34 AM
Unknown Object (File)
May 31 2025, 10:58 AM
Unknown Object (File)
May 27 2025, 9:58 PM
Subscribers
None

Details

Summary

Ref T12857. This is generally fairly fuzzy for now, but here's something concrete: when we build a large file with diffusion.filecontentquery, we compute the MIME type of all chunks, not just the initial chunk.

Instead, pass a dummy MIME type to non-initial chunks so we don't try to compute them. This mirrors logic elsewhere, in file.uploadchunk. This should perhaps be centralized at some point, but it's a bit tricky since the file doesn't know that it's a chunk until later.

Also, clean up the TempFile immediately -- this shouldn't actually affect anything, but we don't need it to live any longer than this.

Test Plan
  • Made hashFileContent() return null to skip the chunk cache.
  • Added phlog() to the MIME type computation.
  • Loaded a 12MB file in Diffusion.
  • Before patch: Saw 3x MIME type computations, one for each 4MB chunk.
  • After patch: Saw 1x MIME type computation, for initial chunk only.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable