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
F18758952: D18138.id43640.diff
Mon, Oct 6, 12:42 AM
F18756490: D18138.id.diff
Sun, Oct 5, 11:41 AM
F18745703: D18138.diff
Fri, Oct 3, 8:51 AM
F18684185: D18138.diff
Sep 26 2025, 8:49 AM
F18590222: D18138.id43640.diff
Sep 12 2025, 5:33 AM
F18588108: D18138.id.diff
Sep 11 2025, 11:19 PM
F18508924: D18138.id.diff
Sep 5 2025, 3:06 AM
F18501224: D18138.diff
Sep 4 2025, 9:37 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