Possible scenarios for a periodic task that is run daily at 11:40 PM to process a data set available globally
Marcee last edited by
I'm testing an e-commerce website and there is a deviation that is occurring on a daily basis for a periodic task that runs daily at 11:40 PM. In essence, what this task does that it picks all orders that are in a certain state (say state='X') and mark them as cancelled if the order reached state 'X' in the same day on which the task is triggered. Now in the database (mongo collection), the time on which an order reached state 'X' is saved as IST. The deviation is there only for clients in Bangladesh that differs from Indian time by half an hour and my best guess is that the date changes. That said, the development team is pretty sure that this couldn't be the reason as they save the time in IST (something like 2018-11-14 17:36:59.439947) for all clients alike.
It sounds like you already have a scenario that isn't working, but the developers don't think that it's likely to be a problem.
My suggestion for your situation is to work closely with the developers to set up and run the scenario you've described, and have them run a debugger on it, stepping through each decision that it makes regarding what records it chooses, and how it processes them.
If it is consistently missing records from a certain timezone, then the developers should have no problem debugging the code and finding the reason. This is a lot simpler than trying to guess what the scheduled task is doing.
If you're unable to recreate initially (based on the time of day the script is running being different), there should be a way for the developers to manipulate the time-source that the script is using, to believe that it is 11:40.
You may also wish to ask the developers how long the script typically takes to execute. If it's over 20 minutes, and the script gets the current day each time, when it moves past 12:00 it will be a different day, and no records will have moved into state X on that day.
If you want any scenarios to help narrow it down, you may need to make it clearer what the exact problem is. Perhaps write it how you would write a bug report. "Given When Then" format would be ideal.