You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more a question than an issue. Do you think an optional parameter for timeout will be beneficial?
If found this code in a legacy project I am mantaining
/**
* Keep trying a number of times until it actually saves. This is for really important tasks.
*
* @param $entity
* @param int $iterations
* @return bool
*/
public function reallySave( $entity, $iterations = 5 ) {
for( $i = 0; $i < $iterations; $i++ ) {
if( $entity->save() ) {
return TRUE;
}
//sleep for 100 milliseconds between each try. Without the delay two back to back attempts are likely to fail.
usleep( 100 * 1000 );
}
return FALSE;
}
I don't know if this is a bad practice, but I think retry could replace this.
The text was updated successfully, but these errors were encountered:
This is more a question than an issue. Do you think an optional parameter for timeout will be beneficial?
If found this code in a legacy project I am mantaining
I don't know if this is a bad practice, but I think retry could replace this.
The text was updated successfully, but these errors were encountered: