Automattic / kue

Kue is a priority job queue backed by redis, built for node.js.
http://automattic.github.io/kue
MIT License
9.46k stars 867 forks source link

created_at is a number when creating job but string when getting a job #1081

Open amiram opened 7 years ago

amiram commented 7 years ago

When you create a job, created_at is a number: const job = queue.create(type, data) job.save(() => { // job.created_at is a number }

When you get the job, it is a string: kue.Job.get(id, (job) => { // job.created_at is a string here });

Since created_at is a date number, shouldn't it be a number everywhere? It can be easily fixed with converting it to number here: https://github.com/Automattic/kue/blob/master/lib/queue/job.js#L195 Perhaps all the following values should be converted either?

behrad commented 7 years ago

thank you @amiram Can you provide a PR please?

michelem09 commented 7 years ago

This is valid for any other timestamp field or at least also promote_at is a string instead a number.

amiram commented 7 years ago

@michelem09 my pr also fixed that. I need to fix the tests still

michelem09 commented 7 years ago

Yes thanks, I saw