Reputation: 59
I am doing a Eval to check whether if server goes down
eval{
foreach(){
Processing 10,000 UPCS in API one by one
}
};
if($@){
continue;
sleep(1200);
}
The above code works fine but the problem is if server goes down it is skipping the current UPC(Loop) and it id processing the next UPC(Loop).
Instead of skipping the UPC(Loop) i have to retry the same upc if server goes down?
Upvotes: 1
Views: 1108
Reputation: 98388
Move the eval into the loop and use redo:
foreach ... {
eval {
};
if ($@) {
sleep 1200;
redo;
}
}
though I'm not sure what your continue
was supposed to be doing; I doubt it did what you expected.
Upvotes: 3