public static function waitForServerToBecomeResponsiveAgain() { // the 503 lockout is usually 120 seconds $start = microtime(true); while (true) { try { $getList = PromisePay::Transaction()->getList(array('limit' => 1, 'offset' => 0)); break; } catch (\PromisePay\Exception\Api $e) { sleep(5); } } if (PromisePay::isDebug()) { fwrite(STDOUT, sprintf('Amount of time server was unresponsive: %f seconds' . PHP_EOL, microtime(true) - $start)); } }