From ad18ac03b49c5205c19493e6c1ae4a09b3b681c0 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 7 Jul 2026 08:54:14 +0300 Subject: [PATCH 1/3] update --- app/controllers/general.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index 5d4684591a..bcd9c82174 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1697,22 +1697,17 @@ Http::get('/v1/ping') } $pingCount = $project->getAttribute('pingCount', 0) + 1; - $pingedAt = DateTime::now(); - $project - ->setAttribute('pingCount', $pingCount) - ->setAttribute('pingedAt', $pingedAt); + if ($pingCount <= 1) { + $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ + 'pingCount' => $pingCount, + 'pingedAt' => DateTime::now(), + ]))); - $authorization->skip(function () use ($dbForPlatform, $project) { - $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'pingCount' => $project->getAttribute('pingCount'), - 'pingedAt' => $project->getAttribute('pingedAt') - ])); - }); - - $queueForEvents - ->setParam('projectId', $project->getId()) - ->setPayload($response->output($project, Response::MODEL_PROJECT)); + $queueForEvents + ->setParam('projectId', $project->getId()) + ->setPayload($response->output($project, Response::MODEL_PROJECT)); + } $response->text('Pong!'); }); From 8c50a32f9ec9ec8d0810d0e79ded487c9a66cee9 Mon Sep 17 00:00:00 2001 From: Shmuel Fogel Date: Tue, 7 Jul 2026 09:15:18 +0300 Subject: [PATCH 2/3] Update app/controllers/general.php Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index bcd9c82174..8e2fd23d46 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -1698,7 +1698,7 @@ Http::get('/v1/ping') $pingCount = $project->getAttribute('pingCount', 0) + 1; - if ($pingCount <= 1) { + if ($pingCount === 1) { $project = $authorization->skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ 'pingCount' => $pingCount, 'pingedAt' => DateTime::now(), From 27a894e77d2d80d7f3315f1239c257c002b285f4 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 7 Jul 2026 09:17:35 +0300 Subject: [PATCH 3/3] fix test --- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index f8de004a6a..b6ef36051e 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -836,7 +836,7 @@ final class ProjectsConsoleClientTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $id = $response['body']['$id']; - // Increase ping 3x + // Ping 3x; only the first is recorded, so pingCount stays at 1 for ($i = 0; $i < 3; $i++) { $response = $this->client->call( Client::METHOD_GET, @@ -1113,7 +1113,7 @@ final class ProjectsConsoleClientTest extends Scope $this->assertSame('', $response['body']['smtpUsername']); $this->assertSame('', $response['body']['smtpPassword']); // Write only $this->assertSame('', $response['body']['smtpSecure']); - $this->assertSame(3, $response['body']['pingCount']); + $this->assertSame(1, $response['body']['pingCount']); $this->assertIsString($response['body']['pingedAt']); $this->assertNotEmpty($response['body']['pingedAt']);