Right now I have a single process that has 3 bots running at the same time. Each loop on each bot will pull an item from the queue, process that data, store the processed data into a global DataTable, and repeat until the queue is empty and then put the DataTable into an excel file and email that file. I am trying to stop 2 of the bots early so the last bot can collect all the data from all three bots and only send one email & api call, instead of 3. The gist of the logic I am currently using is below:
Get Queue Item
Get Queue Count
If Queue Count = 15 or Queue Count = 5 process that Queue Item, then stop
Else continue processing until queue is empty.
The two numbers are arbitrary, just used to flag the bot to stop. The issue we are running into is that sometimes two bots will hit the same number and the rest of the process won’t finish (ex. two of the bots will hit 15 and the last one will hit 5 and leaving a couple items in the queue and no email gets sent). From what I understand, the orchestrator queue count doesn’t refresh fast enough when the bots are checking the count. Is there a way to make sure two bots will never hit the same stop number?