rename to google-datastore, and use Date.now()

This commit is contained in:
Yuan Gao 2018-09-01 21:11:58 +01:00 committed by GitHub
parent 5fb43eb67c
commit d41d7491d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,8 +14,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 expireTime = (skipExpire || this.expire === undefined) ? null : new Date(Date.now() + this.expire * 1000);
var expireTime = (skipExpire || this.expire === undefined) ? 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 = {
@ -59,7 +58,6 @@ class GoogleDatastoreDocumentStore {
else { else {
// update expiry // update expiry
var now = new Date();
var task = { var task = {
key: taskKey, key: taskKey,
data: [ data: [
@ -70,7 +68,7 @@ class GoogleDatastoreDocumentStore {
}, },
{ {
name: 'expiration', name: 'expiration',
value: new Date(now.getTime() + this.expire * 1000) value: new Date(Date.now() + this.expire * 1000)
} }
] ]
}; };