fix redis sync
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Timo Hocker 2022-08-10 16:17:00 +02:00
parent 7bb6dac737
commit b43190d048
No known key found for this signature in database
GPG Key ID: 3B86485AC71C835C
2 changed files with 45 additions and 44 deletions

View File

@ -59,8 +59,9 @@ export class Redis {
log('redis is inactive, skipping');
return;
}
const valid_for = (key.valid_until - (new Date)
.getTime ()) / 1000;
const valid_for = Math.floor(
(key.valid_until - new Date().getTime()) / 1000
);
log('key is valid for %d seconds', valid_for);
await this._redis.setex(key.index, valid_for, JSON.stringify(key));
log('saved key');
@ -83,4 +84,4 @@ export class Redis {
}
}
export const redis = new Redis;
export const redis = new Redis();

View File

@ -1,6 +1,6 @@
{
"name": "@sapphirecode/auth-server-helper",
"version": "3.3.2",
"version": "3.3.3",
"main": "dist/lib/index.js",
"author": {
"name": "Timo Hocker",