Using _retry(..) for IM post updates
Publish PHP Package / docker (push) Successful in 6s
Details
Publish PHP Package / docker (push) Successful in 6s
Details
This commit is contained in:
parent
7c3f74772e
commit
037ab21fae
10
atf.inc.php
10
atf.inc.php
|
@ -114,17 +114,17 @@ function _try_lz4_replay(string $txt)
|
|||
return "4:" . base64_encode(lz4_compress(base64_decode($txt)));
|
||||
}
|
||||
|
||||
function log($msg)
|
||||
function log(string $msg)
|
||||
{
|
||||
echo date("Y-m-d H:i:s") . " " . $msg . "\n";
|
||||
}
|
||||
|
||||
function err($msg)
|
||||
function err(string $msg)
|
||||
{
|
||||
taskman\stderr(date("Y-m-d H:i:s") . " " . $msg . "\n");
|
||||
}
|
||||
|
||||
function _retry($max_tries, $func)
|
||||
function _retry(int $max_tries, callable $func, int $sleep = 1)
|
||||
{
|
||||
for($i=0;$i<$max_tries;++$i)
|
||||
{
|
||||
|
@ -133,12 +133,12 @@ function _retry($max_tries, $func)
|
|||
$func();
|
||||
return;
|
||||
}
|
||||
catch(Exception $e)
|
||||
catch(\Throwable $e)
|
||||
{
|
||||
if(($i+1) == $max_tries)
|
||||
throw $e;
|
||||
}
|
||||
sleep(1);
|
||||
sleep($sleep);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,9 @@ class Plan
|
|||
try
|
||||
{
|
||||
//let's not exit the testing just because we couldn't update IM thread for some reason
|
||||
_retry(3, function() {
|
||||
$this->_updateMessengerThread(false);
|
||||
});
|
||||
}
|
||||
catch(\Throwable $e)
|
||||
{
|
||||
|
@ -296,7 +298,10 @@ class Plan
|
|||
}
|
||||
}
|
||||
|
||||
_retry(3, function() {
|
||||
$this->_updateMessengerThread(true);
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue