Closed gapple closed 10 years ago
The issue with there being no way to tell the difference between an incomplete and a failed estimate was resolved with
completed
column was added to estimatesCaching headers are improved in 7777ab0bbdf32d1234f7635724b26e3f73ab4876
New configuration values are required in order to calculate the cache periods.
Responses that we know will not change are set to be cached for a year.
Right now caching is set to static values, even though we generally know the exact time that data will change. This results in caches being less effective and precise than possible.
For example:
Given that we know the interval between sample fetches and estimate generations, we can set the max-age to the interval between the current time and the time new data is expected to be available (or slightly less).
For example:
max-age: 20700
)max-age: 20700; Age: 19800
, so will only be cached for a further 15 minutesIf a new sample isn't available when expected the max-age can be set to a moderate value until the new data is available. This is more feasible for samples (where the new values will be available in a matter of minutes) and not so well for estimates (which can take hours).
Estimates throw a bit of a kink in this method though, since a placeholder value is stored based on the last sample it was generated from, and the actual estimate may not be available for a few hours afterwards (and there's no indication of the difference between an incomplete estimate and a script timeout). Samples also have a very short window where the
estimates
row is stored but not all the relatedestimate_values
rows, but this should be solvable by utilizing a transaction.