mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
UI, history: update using xhr date header
Makes the 'updated since' contents query based on any previous update's ajax Date response header instead of the client time. This may offer more protection against incorrect client time. This works (and may work better than the previous method) because the Date header is floored and not rounded and seems to mark a time before the contents query is made. Resolves #2242 (hopefully)
This commit is contained in:
@@ -172,10 +172,16 @@ var History = Backbone.Model
|
||||
var self = this;
|
||||
|
||||
var lastUpdateTime = self.lastUpdateTime;
|
||||
self.lastUpdateTime = new Date();
|
||||
// note if there was no previous update time, all summary contents will be fetched
|
||||
// note: if there was no previous update time, all summary contents will be fetched
|
||||
return self.contents.fetchUpdated( lastUpdateTime )
|
||||
.done( _.bind( self.checkForUpdates, self ) );
|
||||
.done( function( response, status, xhr ){
|
||||
var serverResponseDatetime;
|
||||
try {
|
||||
serverResponseDatetime = new Date( xhr.getResponseHeader( 'Date' ) );
|
||||
} catch( err ){}
|
||||
self.lastUpdateTime = serverResponseDatetime || new Date();
|
||||
self.checkForUpdates( options );
|
||||
});
|
||||
},
|
||||
|
||||
/** */
|
||||
@@ -208,7 +214,6 @@ var History = Backbone.Model
|
||||
} else {
|
||||
// otherwise, let listeners know that all updates have stopped
|
||||
self.trigger( 'ready' );
|
||||
// self.lastUpdateTime = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user