updated to use Date(null)

This commit is contained in:
Yuan 2018-08-28 00:35:09 +01:00
parent 2213c3874a
commit b0bbb72f35

View file

@ -15,7 +15,7 @@ class GoogleDatastoreDocumentStore {
// Save file in a key // Save file in a key
set(key, data, callback, skipExpire) { set(key, data, callback, skipExpire) {
var now = new Date(); var now = new Date();
var expireTime = skipExpire ? null : new Date(now.getTime() + this.expire * 1000); var expireTime = skipExpire ? new Date(null) : new Date(now.getTime() + this.expire * 1000);
var taskKey = this.datastore.key([this.kind, key]) var taskKey = this.datastore.key([this.kind, key])
var task = { var task = {
@ -52,7 +52,7 @@ class GoogleDatastoreDocumentStore {
} }
else { else {
// check for expiry // check for expiry
if (entity[0]["expiration"] != null && entity[0]["expiration"] < new Date()) { if (entity[0]["expiration"] != new Date(null) && entity[0]["expiration"] < new Date()) {
winston.info("document expired", {key: key}); winston.info("document expired", {key: key});
callback(false); callback(false);
} }