Page MenuHomePhorge

D5442.1775243751.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D5442.1775243751.diff

diff --git a/docs/SQL/mysql.initial.sql b/docs/SQL/mysql.initial.sql
--- a/docs/SQL/mysql.initial.sql
+++ b/docs/SQL/mysql.initial.sql
@@ -31,6 +31,7 @@
`calendarfilter_id` varchar(40) DEFAULT NULL,
`tasksfilter_id` varchar(40) DEFAULT NULL,
`emailfilter_id` varchar(40) DEFAULT NULL,
+ `extra_data` longblob DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `owner_id--deviceid` (`owner_id`, `deviceid`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
@@ -128,4 +129,4 @@
PRIMARY KEY (`name`)
) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-INSERT INTO `system` (`name`, `value`) VALUES ('syncroton-version', '2025060500');
+INSERT INTO `system` (`name`, `value`) VALUES ('syncroton-version', '2025070300');
diff --git a/docs/SQL/mysql/2025070300.sql b/docs/SQL/mysql/2025070300.sql
new file mode 100644
--- /dev/null
+++ b/docs/SQL/mysql/2025070300.sql
@@ -0,0 +1,2 @@
+
+ALTER TABLE `syncroton_device` ADD `extra_data` longblob DEFAULT NULL;
diff --git a/lib/ext/Syncroton/Command/Ping.php b/lib/ext/Syncroton/Command/Ping.php
--- a/lib/ext/Syncroton/Command/Ping.php
+++ b/lib/ext/Syncroton/Command/Ping.php
@@ -113,11 +113,28 @@
}
}
+ // Update the device entry with the latest timestamp and retry counter
$this->_device->lastping = new DateTime('now', new DateTimeZone('UTC'));
-
+ $extraData = json_decode($this->_device->extraData, true);
+ $retryCounter = $extraData['pingRetryCounter'] ?? 0;
if ($status == self::STATUS_NO_CHANGES_FOUND) {
- $this->_device = $this->_deviceBackend->update($this->_device); // @phpstan-ignore-line
+ $retryCounter = 0;
+ } else {
+ $retryCounter++;
+ }
+ if ($retryCounter >= 10) {
+ if ($this->_logger instanceof Zend_Log) {
+ $this->_logger->warn(__METHOD__ . '::' . __LINE__ . " This client is stuck in a loop on Ping status $status");
+ }
+ call_user_func(Syncroton_Registry::getSleepCallback());
+ sleep(10);
+ header('X-MS-ASThrottle: CommandFrequency');
+ header('HTTP/1.1 503 Service Unavailable');
+ exit;
}
+ $extraData['pingRetryCounter'] = $retryCounter;
+ $this->_device->extraData = json_encode($extraData);
+ $this->_device = $this->_deviceBackend->update($this->_device); // @phpstan-ignore-line
$lifeTime = $this->_device->pinglifetime;
$maxInterval = Syncroton_Registry::getPingInterval();
diff --git a/lib/ext/Syncroton/Model/IDevice.php b/lib/ext/Syncroton/Model/IDevice.php
--- a/lib/ext/Syncroton/Model/IDevice.php
+++ b/lib/ext/Syncroton/Model/IDevice.php
@@ -38,6 +38,7 @@
* @property string $emailfilter_id
* @property string $lastsynccollection
* @property DateTime $lastping
+ * @property string $extraData JSON-encoded array
*
* @phpstan-require-extends Syncroton_Model_Device
*/

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 7:15 PM (1 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18825901
Default Alt Text
D5442.1775243751.diff (2 KB)

Event Timeline