grantcarthew / node-rethinkdb-job-queue

A persistent job or task queue backed by RethinkDB.
https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki
MIT License
156 stars 16 forks source link

Control over logs inside job #89

Open tommmn opened 5 years ago

tommmn commented 5 years ago

Hey, I dunno if this repo is still maintained, But I would like to know if there are options to control the logs. I have a queue of scheduled SMS messages that should process in specific date(User choice), so I use the dateEnable to set the specific date. The user has the control to change it anytime as long as the SMS's haven't been sent yet. So I update the job via the name which links to the original job of the user and everything works great, the jobs get update correctly without duplicates and such.

My question is about logs, since there is not a real reason to keep all the changes that the user done, I would like to keep maybe the last 3 or 5 most recent logs to avoid unnecessary storage. I didn't find this option in the Wiki, maybe I missed or maybe its not implemented yet. I would like to know if its possible. Thanks alot.

grantcarthew commented 5 years ago

Hi @tommmn.

I spent a great amount of time on the Wiki as you can see here: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Options#queue-limitjoblogs-option

It is fully up to date.

Feel free to open this issue if you have any other problems.

tommmn commented 5 years ago

@grantcarthew , thanks for your reply, unfortunately, this is not what I've looking for. As I mentioned, I use dateEnable to specific date, hence, the job is not processed yet. From you docs:

It is important to note that the log limit is only applied during the job completion or failure. If some other processing is applied to a single job and it is never completed or failed the log limit will not apply.

I have already tried that option, but since the jobs aren't in state of Completion or Failure it keeps logging.

grantcarthew commented 5 years ago

Ah, ok, my mistake @tommmn.

I just had a look at the code and at a glance can't see why I didn't truncate the logs inside the job-log.js module.

Looks like it will need to be added to the project as a feature. The other option is to backdoor the rethinkdb-job-queue module and truncate the logs in an external update process. Better to add it as a feature though.

Are you keen to have a go? (Reference #90)

tommmn commented 5 years ago

@grantcarthew , yea I thought that you have misunderstood me. Well, If I'll have some spare time next week I might have a look. Unless you already know exactly whats need to be done and its pretty quick feature.

grantcarthew commented 5 years ago

I've sent you an invite to be a Collaborator. If you need help please ask.

Note that this package was made before async/await was a thing.

If you are keen you could upgrade the dependencies and node engine to start using newer language features.

Where are you located?