Unverified Commit 37cf05e4 authored by Armando Lüscher's avatar Armando Lüscher Committed by GitHub

Merge pull request #765 from jacklul/fix

Do not process duplicated updates, prevent stopping the script
parents f7cac58d aff76281
......@@ -492,10 +492,6 @@ class DB
$update_id = $update->getUpdateId();
$update_type = $update->getUpdateType();
if (count(self::selectTelegramUpdate(1, $update_id)) === 1) {
throw new TelegramException('Duplicate update received!');
}
// @todo Make this simpler: if ($message = $update->getMessage()) ...
if ($update_type === 'message') {
$message = $update->getMessage();
......
......@@ -457,6 +457,12 @@ class Telegram
//This is necessary to "require" all the necessary command files!
$this->getCommandsList();
//Make sure we don't try to process update that was already processed
if (count(DB::selectTelegramUpdate(1, $this->update->getUpdateId())) === 1) {
TelegramLog::debug('Duplicate update received, processing aborted!');
return Request::emptyResponse();
}
DB::insertRequest($this->update);
return $this->executeCommand($command);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment