From 1eeef4ede46c1151c6f0f64cd76a4b2268b700e4 Mon Sep 17 00:00:00 2001 From: Yuan Date: Tue, 28 Aug 2018 01:21:37 +0100 Subject: [PATCH] restored using null --- lib/document_stores/googledatastore.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/document_stores/googledatastore.js b/lib/document_stores/googledatastore.js index 97385f1..6e6dcd3 100644 --- a/lib/document_stores/googledatastore.js +++ b/lib/document_stores/googledatastore.js @@ -15,7 +15,7 @@ class GoogleDatastoreDocumentStore { // Save file in a key set(key, data, callback, skipExpire) { var now = new Date(); - var expireTime = skipExpire ? new Date(null) : new Date(now.getTime() + this.expire * 1000); + var expireTime = skipExpire ? null : new Date(now.getTime() + this.expire * 1000); var taskKey = this.datastore.key([this.kind, key]) var task = { @@ -47,13 +47,13 @@ class GoogleDatastoreDocumentStore { this.datastore.get(taskKey).then((entity) => { - if (skipExpire) { + if (skipExpire || entity[0]["expiration"] == null) { callback(entity[0]["value"]); } else { // check for expiry - if (entity[0]["expiration"] != new Date(null) && entity[0]["expiration"] < new Date()) { - winston.info("document expired", {key: key}); + if (entity[0]["expiration"] < new Date()) { + winston.info("document expired", {key: key, expiration: entity[0]["expiration"], check: new Date(null)}); callback(false); } else {