Skip to content

Commit

Permalink
Improve logic
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Jun 16, 2023
1 parent b6ecffa commit 42ecf91
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/MTProtoSession/ResponseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ private function handleRpcError(OutgoingMessage $request, array $response): ?cal
$this->methodRecall(['message_id' => $request->getMsgId(), 'postpone' => true]);
return null;
}
if ($response['error_code'] === -503 || \in_array($response['error_message'], ['MSGID_DECREASE_RETRY', 'HISTORY_GET_FAILED', 'RPC_CONNECT_FAILED', 'RPC_CALL_FAIL', 'RPC_MCGET_FAIL', 'PERSISTENT_TIMESTAMP_OUTDATED', 'RPC_MCGET_FAIL', 'no workers running', 'No workers running', '-503'])) {
if ((($response['error_code'] === -503 || $response['error_message'] === '-503') && !\in_array($request->getConstructor(), ['messages.getBotCallbackAnswer', 'messages.getInlineBotResults'], true))
|| (\in_array($response['error_message'], ['MSGID_DECREASE_RETRY', 'HISTORY_GET_FAILED', 'RPC_CONNECT_FAILED', 'RPC_CALL_FAIL', 'RPC_MCGET_FAIL', 'PERSISTENT_TIMESTAMP_OUTDATED', 'RPC_MCGET_FAIL', 'no workers running', 'No workers running']))) {
EventLoop::delay(1.0, fn () => $this->methodRecall(['message_id' => $request->getMsgId()]));
return null;
}
Expand Down

0 comments on commit 42ecf91

Please sign in to comment.