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

Merge branch 'develop' into getupdates_without_db

parents 218359f8 0cd6bad3
...@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c ...@@ -6,6 +6,7 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
## [Unreleased] ## [Unreleased]
### Added ### Added
### Changed ### Changed
- Add debug log entry instead of throwing an exception for duplicate updates.
### Deprecated ### Deprecated
### Removed ### Removed
### Fixed ### Fixed
......
...@@ -23,6 +23,5 @@ W: http://noplanman.ch ...@@ -23,6 +23,5 @@ W: http://noplanman.ch
D: Maintainer and Collaborator D: Maintainer and Collaborator
N: Jack'lul (alias) N: Jack'lul (alias)
E: jacklul@jacklul.com E: jacklulcat@gmail.com
W: http://jacklul.com
D: Maintainer and Collaborator D: Maintainer and Collaborator
...@@ -492,10 +492,6 @@ class DB ...@@ -492,10 +492,6 @@ class DB
$update_id = $update->getUpdateId(); $update_id = $update->getUpdateId();
$update_type = $update->getUpdateType(); $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()) ... // @todo Make this simpler: if ($message = $update->getMessage()) ...
if ($update_type === 'message') { if ($update_type === 'message') {
$message = $update->getMessage(); $message = $update->getMessage();
......
...@@ -469,6 +469,12 @@ class Telegram ...@@ -469,6 +469,12 @@ class Telegram
//This is necessary to "require" all the necessary command files! //This is necessary to "require" all the necessary command files!
$this->getCommandsList(); $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); DB::insertRequest($this->update);
return $this->executeCommand($command); 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