One of my php scripts tends to run a long time because it processes several jobs in a while loop. (It pulls records from a database and processes them.) Potentially, some of these records go on for a very long time or hang, which basically kills the whole process since the next record in the loop is never loaded. So I want to implement a timer in the loop which will prevent any single processing event from executing more than xx seconds. Here's a pseudo-code snippet that illustrates what I'm talking about:
//ideally a timer would go here, to make sure we don't stay in this record in the loop more than xx seconds
//this is where the code is executed
//sometimes, processing 'stalls' because of network issues within this while loop, which hangs the script because the next record in the array is never 'loaded'
Basically, I want something so if the timer comes back with a 'time is up' message, it aborts the current record, returns an error, and the loop can move on to process the next record.
Please feel free to ask me any questions you might have.
11 freelancers estão ofertando em média $58 para esse trabalho
Can be done exactly with your 100% satisfaction. Though my bid is a little bit higher, I'm requesting you to have a look at my reviews. Thanks, Tonmay