startProcessInstanceByKey() doesn't run in the subsequent cycles

I have a process that loops and checks if there are new requests in a queue. If there are new requests, it should start process instances with some process variables for that request. The script works initially (logging and the new process instances are created) however, subsequent calls only log and no new process instances are created.

Script
image

image

Actually the processes were being created. They just did not appear in the task list after the initial run through the cycle.