Set Nuget version endpoint update to 42 minutes

This commit is contained in:
Thaddee Tyl 2017-02-01 23:59:08 +01:00
parent 361a6e344a
commit 7f79712f0d

View File

@ -3494,7 +3494,15 @@ function mapNugetFeed(pattern, offset, getInfo) {
function getNugetVersion(apiUrl, id, includePre, request, done) {
// get service index document
regularUpdate(apiUrl + '/index.json',
(3600 * 1000 * 24), // 1 day - can theoretically change often but in practice it doesn't
// The endpoint changes once per year (ie, a period of n = 1 year).
// We minimize the users' waiting time for information.
// With l = latency to fetch the endpoint and x = endpoint update period
// both in years, the yearly number of queries for the endpoint are 1/x,
// and when the endpoint changes, we wait for up to x years to get the
// right endpoint.
// So the waiting time within n years is n*l/x + x years, for which a
// derivation yields an optimum at x = sqrt(n*l), roughly 42 minutes.
(42 * 60 * 1000),
function(buffer) {
var data = JSON.parse(buffer);