From 3c71bbd643c91403d6566c722eed6a9b18183936 Mon Sep 17 00:00:00 2001 From: Matt Hampel Date: Wed, 1 Oct 2014 17:43:55 -0400 Subject: [PATCH] metadata.requested should be compared against exportRequestDuration --- lib/controllers/responses.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/controllers/responses.js b/lib/controllers/responses.js index 2cb647f..8b44927 100644 --- a/lib/controllers/responses.js +++ b/lib/controllers/responses.js @@ -988,7 +988,7 @@ function handleExport(req, res, type) { var metadata = doc.exports[type]; // See when we kicked off the export. If it was a long time ago, then we need to kick off a background task. - if (metadata.requested < now - exportDuration) { + if (metadata.requested < now - exportRequestDuration) { console.log(util.format('info at=export event=generate reason=stale_metadata request_time=%d now=%d export_duration=%d', metadata.requested, now, exportDuration)); generate(); return; @@ -1021,6 +1021,7 @@ function handleExport(req, res, type) { var lastModifiedText = head.headers['last-modified']; var lastModified = new Date(lastModifiedText); + // If the file exists and is old, kick off a background task. if (!lastModifiedText || lastModified < now - exportDuration || lastModified < metadata.requested) { console.log(util.format('info at=export event=generate reason=stale_export export_time=%d now=%d export_duration=%d', lastModified, now, exportDuration));