-
-
Save k1ic/d619d078bc429069b205 to your computer and use it in GitHub Desktop.
rety_func
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _retry($function, $params, $max = 3) { | |
$this->_retry++; | |
if ($this->_retry >= $max) { | |
$this->_retry = 0; | |
Hades_Tool_Log::logRun("p:{$this->_processNumber}|retry_max|function:" . json_encode($function) . "|params:" . json_encode($params), false, __FUNCTION__, $this->_className, Hades_Tool_Log::TYPE_EVE); | |
return false; | |
} | |
usleep(20000); | |
Hades_Tool_Log::logRun("p:{$this->_processNumber}|retry|count:{$this->_retry}|function:" . json_encode($function) . "|params:" . json_encode($params), false, __FUNCTION__, $this->_className, Hades_Tool_Log::TYPE_EVE); | |
$result = call_user_func_array($function, $params); | |
if ($result != false) { | |
$this->_retry = 0; | |
} | |
return $result; | |
} | |
$this->_retry(array($this, __FUNCTION__), func_get_args()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment