So these projects work for a few days, and then problems appear, right?
Please attach a test project with which you can repeat the problem, here or in the forum PM.
Here's a suggestion:
Mark the time when starting the thread.
Then during the script run, add a time check action and compare the time difference with your desired value.
-> Take appropriate action.