Page MenuHomePhabricator

Make the Files "TTL" API more structured
ClosedPublic

Authored by epriestley on Apr 4 2017, 7:28 PM.
Tags
None
Referenced Files
F14022529: D17616.diff
Wed, Nov 6, 6:03 PM
F14018363: D17616.id42379.diff
Tue, Nov 5, 9:54 AM
F14017065: D17616.id42379.diff
Mon, Nov 4, 2:05 PM
F14014831: D17616.diff
Sun, Nov 3, 8:45 AM
F14005583: D17616.id42379.diff
Sun, Oct 27, 4:10 PM
F14003715: D17616.diff
Sat, Oct 26, 9:45 AM
F13993262: D17616.diff
Tue, Oct 22, 9:45 PM
F13993151: D17616.diff
Tue, Oct 22, 9:00 PM
Subscribers

Details

Summary

Ref T11357. When creating a file, callers can currently specify a ttl. However, it isn't unambiguous what you're supposed to pass, and some callers get it wrong.

For example, to mean "this file expires in 60 minutes", you might pass either of these:

  • time() + phutil_units('60 minutes in seconds')
  • phutil_units('60 minutes in seconds')

The former means "60 minutes from now". The latter means "1 AM, January 1, 1970". In practice, because the GC normally runs only once every four hours (at least, until recently), and all the bad TTLs are cases where files are normally accessed immediately, these 1970 TTLs didn't cause any real problems.

Split ttl into ttl.relative and ttl.absolute, and make sure the values are sane. Then correct all callers, and simplify out the time() calls where possible to make switching to PhabricatorTime easier.

Test Plan
  • Generated an SSH keypair.
  • Viewed a changeset.
  • Viewed a raw diff.
  • Viewed a commit's file data.
  • Viewed a temporary file's details, saw expiration date and relative time.
  • Ran unit tests.
  • (Didn't really test Phragment.)

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • Recognize profile key in parameter dictionary.
  • Also recognize format key in parameter dictionary.
  • Also allow format to accept objects.
This revision is now accepted and ready to land.Apr 4 2017, 9:28 PM
This revision was automatically updated to reflect the committed changes.