We have a method that goes through a list, we take a 50 entries from that list and go through the entries, we delete the entries from the original list when done processing. We then check if the main list is empty or not. If the main list is not empty, we call the method again with an async block. We do this until the main list is empty.
We do this to prevent time outs as we are working with a lot of entries in the list.
When you run Async Code it runs asynchronously blocks inside and when the main thread (process) ends it kills the worker without waiting for the Async Code invocations,
therefore there is no guarantee it complete all async code when the main thread is done.
@vladimir-upirov
Yes that is the goal. To call another instance of the method while the worker ends. The problem is the other instance does not seem to run.
why do you think it does not run the method?
in the current log, you can see only logs from the current invocation and for the next execution there should be a new thread with its id
try to add a print block right before the BG_21_… method
Normally, it invokes the method 4 times in different intances. The 1st invocation,which is the one in the logs of the screenshot, runs fine but for some reason there are times that it just runs once and not invoke the next one and you can see in the prints in the logs from last screenshot that the if statement is true so it should invoke another instance of the method right?
It’s very hard to troubleshoot since it only happens randomly and it doesn’t return an error when it happens either.