I have a web application that is started by my CRM, but sometimes it runs twice in a very short period of time and this is affecting the proper functioning of the code, causing 2 simultaneous executions to be carried out. Is there a way to do it like a queue? So that executions were not carried out at the same time, but instead respected the completion of one to begin the other?
I don't know if it's possible to do what I want but I tried searching here and didn't find anything, as it could have been an error in my research so I decided to open this question.
Use a lock to make the latter runtime instance wait until the previous one has completed.
See Lock Service.