0

I have this worker whose runtime greatly varies from 10 seconds to up to an hour. I want to run this worker every five minutes. This is fine as long as the job finishes within five minutes. However, If the job takes longer Iron.io keeps enqueuing the same task over and over and a bunch of tasks of the same type accumulate while the worker is running.

Furthermore, it is crucial that the task may not run concurrently, so max concurrency for this worker is set to one.

So my question is: Is there a way to prevent Iron.io from enqueuing tasks of workers that are still running?

dft
  • 3
  • 2

2 Answers2

0

Answering my own question.

According to Iron.io support it is not possible to prevent IronWorker from enqueuing tasks of workers that are still running. For cases like mine it is better to have master workers that do the scheduling, i.e. creating/enqueuing tasks from script via one of the client libraries.

dft
  • 3
  • 2
0

The best option would be to enqueue new task from the worker's code. For example, your task is running for 10 sec - 1 hour and enqueues itself at the end (last line of code). This will prevent the tasks from accumulating while the worker is running.

Alex
  • 16
  • 2