From 25c9306ef7bf320d75ae962f17a1153df52eb849 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 13 Mar 2024 09:54:19 +0100 Subject: [PATCH] fix(federation): Write chat value again when it was empty even when there is nothing new Signed-off-by: Joas Schilling --- lib/Federation/Proxy/TalkV1/Controller/ChatController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Federation/Proxy/TalkV1/Controller/ChatController.php b/lib/Federation/Proxy/TalkV1/Controller/ChatController.php index 9a6c0f09970..4aee7fabce2 100644 --- a/lib/Federation/Proxy/TalkV1/Controller/ChatController.php +++ b/lib/Federation/Proxy/TalkV1/Controller/ChatController.php @@ -173,6 +173,12 @@ public function receiveMessages( ); if ($proxy->getStatusCode() === Http::STATUS_NOT_MODIFIED) { + if ($lookIntoFuture && $this->proxyCacheMessages instanceof ICache) { + $cacheData = $this->proxyCacheMessages->get($cacheKey); + if ($cacheData === null || $cacheData < $lastKnownMessageId) { + $this->proxyCacheMessages->set($cacheKey, $lastKnownMessageId, 300); + } + } return new DataResponse([], Http::STATUS_NOT_MODIFIED); } @@ -182,7 +188,7 @@ public function receiveMessages( } if ($proxy->getHeader('X-Chat-Last-Given')) { $headers['X-Chat-Last-Given'] = (string) (int) $proxy->getHeader('X-Chat-Last-Given'); - if ($this->proxyCacheMessages instanceof ICache) { + if ($lookIntoFuture && $this->proxyCacheMessages instanceof ICache) { $cacheData = $this->proxyCacheMessages->get($cacheKey); if ($cacheData === null || $cacheData < $headers['X-Chat-Last-Given']) { $this->proxyCacheMessages->set($cacheKey, (int) $headers['X-Chat-Last-Given'], 300);