Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LASTSAVE broken #2650

Open
rick-rheo opened this issue Nov 8, 2023 · 1 comment
Open

LASTSAVE broken #2650

rick-rheo opened this issue Nov 8, 2023 · 1 comment
Labels

Comments

@rick-rheo
Copy link

Description

client.LASTSAVE returns "1970-01-20T16:04:20.988Z" while redis-cli returns 1699459680. You're feeding seconds into new Date(x) which is expecting milliseconds.

Node.js Version

18+

Redis Server Version

6.2.5

Node Redis Version

redis@4.6.10

Platform

Linux

Logs

No response

@rick-rheo rick-rheo added the Bug label Nov 8, 2023
@leibale
Copy link
Collaborator

leibale commented Nov 8, 2023

I'm pretty sure it's already fixed in the v5 branch, in the meantime you can use .sendCommand instead:

const timestamp = await client.sendCommand(['LASTSAVE']),
  d = new Date(timestamp);

edit: kinda fixed in v5 https://github.com/leibale/node-redis/blob/v5/packages/client/lib/commands/LASTSAVE.ts (its not converting the value to date anymore)

@leibale leibale mentioned this issue Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants