proletarian

comptedeouf 2024-06-27T18:00:57.825039Z

Hi, new proletarian user, is it possible to have the queue processed in order only once a job is successful, so that if I have A,B,C are in the queue B will only be processed once A is successful, C will only be processed once B is successful ?

comptedeouf 2024-06-28T00:10:03.971689Z

I can make it work with a 1 worker-thread and returning a negative :delays from the :retry-strategy-fn, but this required removing the :pre condition on proletarian.retry/retry-data is this something that would be considered or too outside the intent of this lib ?

comptedeouf 2024-07-03T19:34:39.261919Z

Thank you, I was trying to simulate rabbitmq's ack/nack which allows putting a job that "temporarily failed" (like 429 on a service call) back at the top of the queue (nack) so that it will be picked up again, by the single consumer of that queue, until it succeeds (ack). This effectively blockes the queue until the job is successful. In my use case I needed all the jobs to be processed but in order, with a specific delay between calls to an api and to always retry for recoverable errros (like network problem).

msolli 2024-06-28T07:18:12.488319Z

If you want no retries for you jobs, then the correct way to that is to not provide a retry-strategy-fn when creating the worker. Then jobs won't be retried.

msolli 2024-06-28T07:22:17.882029Z

But the way Proletarian works is that failed jobs are recorded in the archive table, and then the next job in the queue is processed. So in your example and with a setup of one worker-thread (on one instance) job B will be processed after job A regardless of the outcome of job A. The way to guarantee that B only will run after A is successful is to enqueue B in job A.