I have a python function that gets called everytime i text a specific number. (Postback function, that runs on flask, and listens for incoming sms.
I also have a function that has a set schedule to run every 5minutes and read from a list and remove some entries.
Now the only problem is both these functions read from the same list.
I'm worried that right when the scheduled function (every 5min) is called to be run, the postback function that handles sms, is called too. What i they both run at the exact same time, and both try to read from the array at the same time. Or if function a reads from the list WHILE function b is writing to the list.
Is this an accurate worry of mine? Can these 2 functions be called at the EXACT same time? Or will it never happen that they simultaneously read from same list at same time.
I looked into async requests with celery, but that doesnt solve the problem. The function that runs every 5 min, could still be called the exact same time as the celery function is called, thus corrupting the list.
Thanks, im just confused