Take cache_buster value, if present, as a Last-Modified timestamp
This makes the Last-Modified header consistent across requests using the same cache_buster (embedded in the token for multilayer API).
This commit is contained in:
parent
76c056c7a1
commit
381b9a9edf
@ -159,13 +159,10 @@ module.exports = function(){
|
||||
callback(null, me.channelCache[cacheKey]);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( req.params.token ) {
|
||||
if ( ! me.channelCache.hasOwnProperty(cacheKey) ) {
|
||||
callback(new Error('missing channel cache for token ' + req.params.token));
|
||||
} else {
|
||||
callback(null, me.channelCache[cacheKey]);
|
||||
}
|
||||
else if ( req.params.token ) {
|
||||
// cached cache channel for token-based access should be constructed
|
||||
// at cache creation time
|
||||
callback(new Error('missing channel cache for token ' + req.params.token));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -219,12 +216,15 @@ module.exports = function(){
|
||||
}
|
||||
|
||||
// Set Last-Modified header
|
||||
//
|
||||
// Currently sets it to NOW
|
||||
//
|
||||
// TODO: find out a real value, querying for most recent change in
|
||||
// any of the source tables
|
||||
res.header('Last-Modified', new Date().toUTCString());
|
||||
var lastUpdated;
|
||||
if ( req.params.cache_buster ) {
|
||||
// Assuming cache_buster is a timestamp
|
||||
// FIXME: store lastModified in the cache channel instead
|
||||
lastUpdated = new Date(parseInt(req.params.cache_buster));
|
||||
} else {
|
||||
lastUpdated = new Date();
|
||||
}
|
||||
res.header('Last-Modified', lastUpdated.toUTCString());
|
||||
|
||||
me.generateCacheChannel(req, function(err, channel){
|
||||
if ( ! err ) {
|
||||
|
Loading…
Reference in New Issue
Block a user