4 ms·
What would be nice is a way of preventing the same job running multiple times concurrently. Like if I start a job and a job with the same parameters was already
by cjdell 6y ago
What would be nice is a way of preventing the same job running multiple times concurrently. Like if I start a job and a job with the same parameters was already started milliseconds ago then it automatically awaits the already running job rather than starting another.
- sbarre 6y agoYou could build a reasonably lightweight supervisor pattern that uses a parameter-derived hash for comparison to handle this kind of situation in your application too. Might be easier and more flexible than asking the library to do it?
- tomwojcik 6y agoThat's exactly what I do in python with celery. I order all dicts/lists and hash this final object. If hash is not found in the db, I set hash as the task id. With `track started` setting I never run the same task twice.
- fendy3002 6y agoIf you can use redis, redlock can be a nice implementation. Example: https://github.com/fendy3002/NodeLearn/blob/master/Redlock/src/index.ts https://github.com/fendy3002/NodeLearn/blob/master/Redlock/s...
- tekno45 6y agoAdd unique job id?