From 10254c5e24e2f44e3457dfac1cd9f234210fa822 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 8 Aug 2025 23:45:31 +1200 Subject: [PATCH 01/16] Update migrations --- composer.lock | 53 +++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/composer.lock b/composer.lock index 227ee85050..ebec5b0077 100644 --- a/composer.lock +++ b/composer.lock @@ -1228,16 +1228,16 @@ }, { "name": "open-telemetry/context", - "version": "1.2.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/context.git", - "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020" + "reference": "4d5d98f1d4311a55b8d07e3d4c06d2430b4e6efc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/1eb2b837ee9362db064a6b65d5ecce15a9f9f020", - "reference": "1eb2b837ee9362db064a6b65d5ecce15a9f9f020", + "url": "https://api.github.com/repos/opentelemetry-php/context/zipball/4d5d98f1d4311a55b8d07e3d4c06d2430b4e6efc", + "reference": "4d5d98f1d4311a55b8d07e3d4c06d2430b4e6efc", "shasum": "" }, "require": { @@ -1283,7 +1283,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-05-07T23:36:50+00:00" + "time": "2025-08-04T03:25:06+00:00" }, { "name": "open-telemetry/exporter-otlp", @@ -1414,16 +1414,16 @@ }, { "name": "open-telemetry/sdk", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sdk.git", - "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a" + "reference": "86287cf30fd6549444d7b8f7d8758d92e24086ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", - "reference": "1c0371794e4c0700afd4a9d4d8511cb5e3f78e6a", + "url": "https://api.github.com/repos/opentelemetry-php/sdk/zipball/86287cf30fd6549444d7b8f7d8758d92e24086ac", + "reference": "86287cf30fd6549444d7b8f7d8758d92e24086ac", "shasum": "" }, "require": { @@ -1442,7 +1442,7 @@ "ramsey/uuid": "^3.0 || ^4.0", "symfony/polyfill-mbstring": "^1.23", "symfony/polyfill-php82": "^1.26", - "tbachert/spi": "^1.0.1" + "tbachert/spi": "^1.0.5" }, "suggest": { "ext-gmp": "To support unlimited number of synchronous metric readers", @@ -1456,6 +1456,9 @@ "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderHttpConfig", "OpenTelemetry\\API\\Instrumentation\\Configuration\\General\\ConfigEnv\\EnvComponentLoaderPeerConfig" ], + "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\ResolverInterface": [ + "OpenTelemetry\\SDK\\Common\\Configuration\\Resolver\\SdkConfigurationResolver" + ], "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\HookManagerInterface": [ "OpenTelemetry\\API\\Instrumentation\\AutoInstrumentation\\ExtensionHookManager" ] @@ -1504,20 +1507,20 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-06-19T23:36:51+00:00" + "time": "2025-08-06T03:07:06+00:00" }, { "name": "open-telemetry/sem-conv", - "version": "1.32.1", + "version": "1.36.0", "source": { "type": "git", "url": "https://github.com/opentelemetry-php/sem-conv.git", - "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22" + "reference": "60dd18fd21d45e6f4234ecab89c14021b6e3de9a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", - "reference": "94daa85ea61a8e2b7e1b0af6be0e875bedda7c22", + "url": "https://api.github.com/repos/opentelemetry-php/sem-conv/zipball/60dd18fd21d45e6f4234ecab89c14021b6e3de9a", + "reference": "60dd18fd21d45e6f4234ecab89c14021b6e3de9a", "shasum": "" }, "require": { @@ -1561,7 +1564,7 @@ "issues": "https://github.com/open-telemetry/opentelemetry-php/issues", "source": "https://github.com/open-telemetry/opentelemetry-php" }, - "time": "2025-06-24T02:32:27+00:00" + "time": "2025-08-04T03:22:08+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -4098,16 +4101,16 @@ }, { "name": "utopia-php/migration", - "version": "0.11.3", + "version": "0.11.4", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac" + "reference": "e924e6535c4368abd778252da6fa96e423412c67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/fb14e0e35061bfec2656200e3d02a3bdf569a0ac", - "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/e924e6535c4368abd778252da6fa96e423412c67", + "reference": "e924e6535c4368abd778252da6fa96e423412c67", "shasum": "" }, "require": { @@ -4115,7 +4118,7 @@ "ext-curl": "*", "ext-openssl": "*", "php": ">=8.1", - "utopia-php/database": "0.*.*", + "utopia-php/database": "0.71.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", "utopia-php/storage": "0.18.*" @@ -4148,9 +4151,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.11.3" + "source": "https://github.com/utopia-php/migration/tree/0.11.4" }, - "time": "2025-07-30T11:20:31+00:00" + "time": "2025-08-08T11:22:24+00:00" }, { "name": "utopia-php/orchestration", @@ -8364,7 +8367,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -8388,5 +8391,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } From ae5225d8ee691c0a77f838084ddfaf1a2edb384d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 8 Aug 2025 13:58:41 +0200 Subject: [PATCH 02/16] Add placeholder detection --- src/Appwrite/Platform/Workers/Mails.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index 117b689863..a865d474be 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -6,6 +6,7 @@ use Appwrite\Template\Template; use Exception; use PHPMailer\PHPMailer\PHPMailer; use Swoole\Runtime; +use Utopia\CLI\Console; use Utopia\Logger\Log; use Utopia\Platform\Action; use Utopia\Queue\Message; @@ -147,6 +148,17 @@ class Mails extends Action $mail->AltBody = preg_replace('/]*>(.*?)<\/style>/is', '', $mail->AltBody); $mail->AltBody = \strip_tags($mail->AltBody); $mail->AltBody = \trim($mail->AltBody); + + if(\str_contains($mail->Body, 'buttonText') || \str_contains($mail->AltBody, 'buttonText')) { + Console::warning('Email might contain placeholder. Logs relevant to verify and isolate the issue:'); + var_dump($mail->Body); + var_dump($mail->AltBody); + \var_dump($message->getPayload()); + \var_dump($message->getPid()); + \var_dump($message->getQueue()); + \var_dump($message->getTimestamp()); + Console::warning('End of placeholder detection report.'); + } $replyTo = System::getEnv('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM); $replyToName = \urldecode(System::getEnv('_APP_SYSTEM_EMAIL_NAME', APP_NAME . ' Server')); From 1fba63e9865c6be3d4328369b63eeb12bdb1ba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 8 Aug 2025 14:00:30 +0200 Subject: [PATCH 03/16] Fix formatting --- src/Appwrite/Platform/Workers/Mails.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index a865d474be..f07cfcf699 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -148,8 +148,8 @@ class Mails extends Action $mail->AltBody = preg_replace('/]*>(.*?)<\/style>/is', '', $mail->AltBody); $mail->AltBody = \strip_tags($mail->AltBody); $mail->AltBody = \trim($mail->AltBody); - - if(\str_contains($mail->Body, 'buttonText') || \str_contains($mail->AltBody, 'buttonText')) { + + if (\str_contains($mail->Body, 'buttonText') || \str_contains($mail->AltBody, 'buttonText')) { Console::warning('Email might contain placeholder. Logs relevant to verify and isolate the issue:'); var_dump($mail->Body); var_dump($mail->AltBody); From 96b7f31abbd5ed0653f019475ad3e048afe4989f Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Sat, 9 Aug 2025 00:53:33 +1200 Subject: [PATCH 04/16] Fix tests --- .../Services/Migrations/MigrationsBase.php | 23 +- tests/resources/csv/documents-internals.csv | 50 ++--- tests/resources/csv/irrelevant-column.csv | 202 +++++++++--------- 3 files changed, 136 insertions(+), 139 deletions(-) diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 5f40662ec3..05e74418ea 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -1052,9 +1052,9 @@ trait MigrationsBase $this->assertEmpty($migration['body']['statusCounters']); $this->assertThat( implode("\n", $migration['body']['errors']), - $this->stringContains("CSV header mismatch. Missing attribute: 'age'") + $this->stringContains("CSV header validation failed: Missing required attribute: 'age'") ); - }, 60000, 500); + }, 60_000, 500); // missing row data, fail in worker. $missingColumn = $this->performCsvMigration( @@ -1081,11 +1081,11 @@ trait MigrationsBase $this->assertEmpty($migration['body']['statusCounters']); $this->assertThat( implode("\n", $migration['body']['errors']), - $this->stringContains('CSV row does not match the number of header columns') + $this->stringContains('CSV document does not match the number of header attributes') ); - }, 60000, 500); + }, 60_000, 500); - // irrelevant column - email, fail in worker. + // irrelevant column - email, success. $irrelevantColumn = $this->performCsvMigration( [ 'fileId' => $fileIds['irrelevant-column'], @@ -1103,16 +1103,13 @@ trait MigrationsBase $this->assertEquals(200, $migration['headers']['status-code']); $this->assertEquals('finished', $migration['body']['stage']); - $this->assertEquals('failed', $migration['body']['status']); + $this->assertEquals('completed', $migration['body']['status']); $this->assertEquals('CSV', $migration['body']['source']); $this->assertEquals('Appwrite', $migration['body']['destination']); $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); - $this->assertEmpty($migration['body']['statusCounters']); - $this->assertThat( - implode("\n", $migration['body']['errors']), - $this->stringContains("CSV header mismatch. Unexpected attribute: 'email'") - ); - }, 60000, 500); + $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); + $this->assertEquals(100, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); + }, 10_000, 500); // all data exists, pass. $migration = $this->performCsvMigration( @@ -1154,7 +1151,7 @@ trait MigrationsBase $this->assertEquals(200, $documents['headers']['status-code']); $this->assertIsArray($documents['body']['documents']); $this->assertIsNumeric($documents['body']['total']); - $this->assertEquals(100, $documents['body']['total']); + $this->assertEquals(200, $documents['body']['total']); // all data exists and includes internals, pass. $migration = $this->performCsvMigration( diff --git a/tests/resources/csv/documents-internals.csv b/tests/resources/csv/documents-internals.csv index 22144ab0b8..ab8e192a0e 100644 --- a/tests/resources/csv/documents-internals.csv +++ b/tests/resources/csv/documents-internals.csv @@ -1,26 +1,26 @@ $id,$createdAt,$updatedAt,$permissions,name,age -z1y2x3w4v5u6t7s8,2022-10-23T10:33:01+00:00,2023-03-15T12:00:41+00:00,"read(\"any\"),update(\"user:123\")",Diamond Mendez,56 -r9q0p1o2n3m4l5k6,2021-08-11T21:05:13+00:00,2024-01-02T08:45:22+00:00,"read(\"any\"),update(\"user:456\")",Michael Huff,20 -j7i8h9g0f1e2d3c4,2020-05-29T14:22:56+00:00,2022-11-30T18:19:33+00:00,"read(\"any\")",Alyssa Rodriguez,37 -b5a6z7y8x9w0v1u2,2023-01-18T03:44:09+00:00,2023-09-07T23:50:17+00:00,"read(\"any\")",Barbara Smith,26 -t3s4r5q6p7o8n9m0,2020-11-02T09:12:45+00:00,2021-07-21T15:30:55+00:00,"read(\"any\")",Evelyn Edwards,54 -l1k2j3i4h5g6f7e8,2022-03-19T19:55:27+00:00,2024-05-14T06:28:11+00:00,"read(\"any\")",Tina Richardson,41 -d9c0b1a2z3y4x5w6,2021-04-07T01:18:34+00:00,2023-06-25T11:47:04+00:00,"read(\"any\")",Joel Hernandez,49 -v7u8t9s0r1q2p3o4,2023-08-22T16:40:18+00:00,2024-02-19T04:09:58+00:00,"read(\"any\")",Zachary Cooper,59 -n5m6l7k8j9i0h1g2,2020-02-12T07:59:01+00:00,2022-09-08T13:21:49+00:00,"read(\"any\")",Brittany Spears,20 -f3e4d5c6b7a8z9y0,2021-12-05T22:33:12+00:00,2023-11-11T02:55:37+00:00,"read(\"any\")",Holly White,47 -x1w2v3u4t5s6r7q8,2022-07-14T05:01:50+00:00,2024-04-01T20:10:26+00:00,"read(\"any\")",Kimberly Barnes,27 -p9o0n1m2l3k4j5i6,2020-09-28T11:27:36+00:00,2021-10-17T09:38:08+00:00,"read(\"any\")",Stephen Miller,53 -h7g8f9e0d1c2b3a4,2023-04-04T08:15:59+00:00,2024-06-29T17:03:14+00:00,"read(\"any\")",Yvonne Newman,41 -y5x6w7v8u9t0s1r2,2021-01-25T18:09:21+00:00,2022-08-16T22:44:51+00:00,"read(\"any\")",Carol Kane,38 -q3p4o5n6m7l8k9j0,2022-06-09T12:53:47+00:00,2023-12-24T01:16:05+00:00,"read(\"any\")",Doris Foster,44 -i1h2g3f4e5d6c7b8,2020-07-03T23:37:02+00:00,2021-05-09T05:52:43+00:00,"read(\"any\")",Joseph Stokes,28 -a9z0y1x2w3v4u5t6,2023-10-10T02:20:15+00:00,2024-03-28T14:33:29+00:00,"read(\"any\")",Steve Williams,31 -s7r8q9p0o1n2m3l4,2021-06-16T13:48:53+00:00,2022-04-22T07:07:19+00:00,"read(\"any\")",James Carey,29 -k5j6i7h8g9f0e1d2,2022-12-27T20:06:38+00:00,2023-08-03T10:25:57+00:00,"read(\"any\")",Kathryn Henry,38 -c3b4a5z6y7x8w9v0,2020-04-20T04:41:24+00:00,2021-02-13T19:14:06+00:00,"read(\"any\")",Christopher Landry,23 -u1t2s3r4q5p6o7n8,2023-05-08T00:58:10+00:00,2024-07-05T03:36:48+00:00,"read(\"any\")",Jennifer Mcgee,62 -m9l0k1j2i3h4g5f6,2021-09-01T06:11:42+00:00,2022-01-26T16:59:23+00:00,"read(\"any\")",Cathy Church,35 -e7d8c9b0a1z2y3x4,2022-02-18T15:24:07+00:00,2023-04-12T00:40:31+00:00,"read(\"any\")",Jose Lopez,41 -w5v6u7t8s9r0q1p2,2020-12-13T09:03:55+00:00,2021-11-06T11:23:16+00:00,"read(\"any\")",William Rose,30 -o3n4m5l6k7j8i9h0,2021-12-13T09:03:55+00:00,2022-11-06T11:23:16+00:00,"read(\"any\")",Charles Hammer,61 +z1y2x3w4v5u6t7s8,2022-10-23T10:33:01+00:00,2023-03-15T12:00:41+00:00,"read(""any""),update(""user:123"")",Diamond Mendez,56 +r9q0p1o2n3m4l5k6,2021-08-11T21:05:13+00:00,2024-01-02T08:45:22+00:00,"read(""any""),update(""user:456"")",Michael Huff,20 +j7i8h9g0f1e2d3c4,2020-05-29T14:22:56+00:00,2022-11-30T18:19:33+00:00,"read(""any"")",Alyssa Rodriguez,37 +b5a6z7y8x9w0v1u2,2023-01-18T03:44:09+00:00,2023-09-07T23:50:17+00:00,"read(""any"")",Barbara Smith,26 +t3s4r5q6p7o8n9m0,2020-11-02T09:12:45+00:00,2021-07-21T15:30:55+00:00,"read(""any"")",Evelyn Edwards,54 +l1k2j3i4h5g6f7e8,2022-03-19T19:55:27+00:00,2024-05-14T06:28:11+00:00,"read(""any"")",Tina Richardson,41 +d9c0b1a2z3y4x5w6,2021-04-07T01:18:34+00:00,2023-06-25T11:47:04+00:00,"read(""any"")",Joel Hernandez,49 +v7u8t9s0r1q2p3o4,2023-08-22T16:40:18+00:00,2024-02-19T04:09:58+00:00,"read(""any"")",Zachary Cooper,59 +n5m6l7k8j9i0h1g2,2020-02-12T07:59:01+00:00,2022-09-08T13:21:49+00:00,"read(""any"")",Brittany Spears,20 +f3e4d5c6b7a8z9y0,2021-12-05T22:33:12+00:00,2023-11-11T02:55:37+00:00,"read(""any"")",Holly White,47 +x1w2v3u4t5s6r7q8,2022-07-14T05:01:50+00:00,2024-04-01T20:10:26+00:00,"read(""any"")",Kimberly Barnes,27 +p9o0n1m2l3k4j5i6,2020-09-28T11:27:36+00:00,2021-10-17T09:38:08+00:00,"read(""any"")",Stephen Miller,53 +h7g8f9e0d1c2b3a4,2023-04-04T08:15:59+00:00,2024-06-29T17:03:14+00:00,"read(""any"")",Yvonne Newman,41 +y5x6w7v8u9t0s1r2,2021-01-25T18:09:21+00:00,2022-08-16T22:44:51+00:00,"read(""any"")",Carol Kane,38 +q3p4o5n6m7l8k9j0,2022-06-09T12:53:47+00:00,2023-12-24T01:16:05+00:00,"read(""any"")",Doris Foster,44 +i1h2g3f4e5d6c7b8,2020-07-03T23:37:02+00:00,2021-05-09T05:52:43+00:00,"read(""any"")",Joseph Stokes,28 +a9z0y1x2w3v4u5t6,2023-10-10T02:20:15+00:00,2024-03-28T14:33:29+00:00,"read(""any"")",Steve Williams,31 +s7r8q9p0o1n2m3l4,2021-06-16T13:48:53+00:00,2022-04-22T07:07:19+00:00,"read(""any"")",James Carey,29 +k5j6i7h8g9f0e1d2,2022-12-27T20:06:38+00:00,2023-08-03T10:25:57+00:00,"read(""any"")",Kathryn Henry,38 +c3b4a5z6y7x8w9v0,2020-04-20T04:41:24+00:00,2021-02-13T19:14:06+00:00,"read(""any"")",Christopher Landry,23 +u1t2s3r4q5p6o7n8,2023-05-08T00:58:10+00:00,2024-07-05T03:36:48+00:00,"read(""any"")",Jennifer Mcgee,62 +m9l0k1j2i3h4g5f6,2021-09-01T06:11:42+00:00,2022-01-26T16:59:23+00:00,"read(""any"")",Cathy Church,35 +e7d8c9b0a1z2y3x4,2022-02-18T15:24:07+00:00,2023-04-12T00:40:31+00:00,"read(""any"")",Jose Lopez,41 +w5v6u7t8s9r0q1p2,2020-12-13T09:03:55+00:00,2021-11-06T11:23:16+00:00,"read(""any"")",William Rose,30 +o3n4m5l6k7j8i9h0,2021-12-13T09:03:55+00:00,2022-11-06T11:23:16+00:00,"read(""any"")",Charles Hammer,61 diff --git a/tests/resources/csv/irrelevant-column.csv b/tests/resources/csv/irrelevant-column.csv index 92105ceaa2..7b690ab71a 100644 --- a/tests/resources/csv/irrelevant-column.csv +++ b/tests/resources/csv/irrelevant-column.csv @@ -1,101 +1,101 @@ -$id,name,age,email -hxfcwpcas5xokpwe,Diamond Mendez,56,diamond.mendez@example.com -gw8nxwf6esn3tfwf,Michael Huff,20,michael.huff@example.com -xb6bxg56lral1qy9,Alyssa Rodriguez,37,alyssa.rodriguez@example.com -imerjq5j36y3agh2,Barbara Smith,26,barbara.smith@example.com -07yq9qdlhmbzmr35,Evelyn Edwards,54,evelyn.edwards@example.com -ksqo631sbhwj5ltg,Tina Richardson,41,tina.richardson@example.com -j7zlndgu0gbshp15,Joel Hernandez,49,joel.hernandez@example.com -mfntvnljrcmf7h6v,Zachary Cooper,59,zachary.cooper@example.com -5f9b01nziqu2h8ed,Brittany Spears,20,brittany.spears@example.com -4vxzbnzraqznk5u8,Holly White,47,holly.white@example.com -d4ywy3mtphaatbpf,Kimberly Barnes,27,kimberly.barnes@example.com -88odnk6nthyyvbal,Stephen Miller,53,stephen.miller@example.com -08oekee3fn7mzaa5,Yvonne Newman,41,yvonne.newman@example.com -quw55kn9895i5e4v,Carol Kane,38,carol.kane@example.com -nge6bm8ykripei6f,Doris Foster,44,doris.foster@example.com -4k16i33s0xl2ypx9,Joseph Stokes,28,joseph.stokes@example.com -q0j5rxbgid66snyf,Steve Williams,31,steve.williams@example.com -n1oxun7mqq3p103y,James Carey,29,james.carey@example.com -0dbvs840jkf8i0ye,Kathryn Henry,38,kathryn.henry@example.com -5sfaidgs1h87v15v,Christopher Landry,23,christopher.landry@example.com -vg3punvfu5khmf41,Jennifer Mcgee,62,jennifer.mcgee@example.com -f933qydr9u5b2r11,Cathy Church,35,cathy.church@example.com -wjv87y1inf8yk32s,Jose Lopez,41,jose.lopez@example.com -uljysdvdlcyrbrwk,William Rose,30,william.rose@example.com -ot8xtzh77j55wq0s,Sarah Ford,26,sarah.ford@example.com -9t76vnsv2u36s43t,Alisha Jones,61,alisha.jones@example.com -66y4tnty62hw8c02,Kristin Kelly,61,kristin.kelly@example.com -2punfblazi5v16ar,Brendan Stout,40,brendan.stout@example.com -sxhr4nf5w2gx4wbg,Kelly Cruz,18,kelly.cruz@example.com -68dvrqfwqnkq5el9,Samantha Martin,50,samantha.martin@example.com -20192l6dbeinhkh0,David Santos,46,david.santos@example.com -si0l4dgay09ebfmf,Elizabeth Carroll,22,elizabeth.carroll@example.com -lhse40vbldqb6ap1,Corey Owens,46,corey.owens@example.com -h5t3pslykyx3kxfm,Shelby Mueller,65,shelby.mueller@example.com -ldc0luydrw6jub0f,Dr. Sylvia Myers,29,sylvia.myers@example.com -voc9628xg4dsgw2y,Scott Freeman,48,scott.freeman@example.com -o4y0gk3gqv1ax2fz,Christopher Atkinson,21,christopher.atkinson@example.com -u1n3x4e4u7e0vzj6,Sean Diaz,31,sean.diaz@example.com -s36eskwtm0w7lwr7,Bobby Dyer,57,bobby.dyer@example.com -4hjnag1p5iwvtixd,Daniel Hall,62,daniel.hall@example.com -m91d80oxsa216zbh,Jennifer Ramirez,65,jennifer.ramirez@example.com -5hj6858zo2g85n6v,Angela Jackson,57,angela.jackson@example.com -8m8oihv9a1e7nn92,Kelly Lewis,36,kelly.lewis@example.com -7azy39la0no0mxi7,Jessica Munoz,55,jessica.munoz@example.com -47pmjkhnnqhyit8c,Kelly George,65,kelly.george@example.com -6j6cpy4kgneg1mmh,Anthony Johnson,65,anthony.johnson@example.com -tnlmtvap1zz89km9,Regina Fields,61,regina.fields@example.com -6cyuvnwwqdmrpfzh,Sharon Schaefer,30,sharon.schaefer@example.com -p1v4pyu2pqodc0ey,Jacob French,62,jacob.french@example.com -6npynnhjt2jd05xo,Jessica Costa,23,jessica.costa@example.com -wcxedf13n2e9qi4l,George Hardy,53,george.hardy@example.com -yf2xlcmszk2tqeig,Andrea Allison,20,andrea.allison@example.com -3bf2zzv7poststwa,Kevin Ferguson,32,kevin.ferguson@example.com -c2iataz0hhv39q63,Joseph Johnson,58,joseph.johnson@example.com -3e8npxhov4a39pvq,Ashley Martinez,18,ashley.martinez@example.com -t7dp41tysipytywq,Charles Nixon,23,charles.nixon@example.com -z8cztq7c47phyfhk,Carol Dudley,40,carol.dudley@example.com -2636f9d8r4ipm3h6,David Weber,51,david.weber@example.com -eh3f6wxtvkjq6ykq,Scott Robinson,32,scott.robinson@example.com -raskbwpsje69a59h,Anthony Hardy,38,anthony.hardy@example.com -90hn1p0b4cs9e2og,Mackenzie Owens,52,mackenzie.owens@example.com -am3swwfbo076x0v1,Brian Foster,27,brian.foster@example.com -5uw7utb9lq5cfncw,Hannah Forbes,56,hannah.forbes@example.com -cs6mbfzkzifefx6r,Lauren Reed,26,lauren.reed@example.com -ftw3uvztziiz9x00,Morgan Smith,28,morgan.smith@example.com -uhrqseeo43mozpaq,Samantha Alexander,65,samantha.alexander@example.com -pvvmzyfc1lxor11e,Tiffany Roberts,20,tiffany.roberts@example.com -jia7bdag4abz123s,Emily Hayes,34,emily.hayes@example.com -h6oozcngbz8o5x4y,Rebecca Villegas,52,rebecca.villegas@example.com -9v6z1pn2f9twcy12,Donald Shah,61,donald.shah@example.com -wzz3jduioso77o7f,Denise Cain,59,denise.cain@example.com -u51plhgvjodkswnr,Kristine Ramirez,53,kristine.ramirez@example.com -t1uhkmiytfyc13vc,Stacey Adkins,61,stacey.adkins@example.com -iqaqnf0ybg2ct507,Daniel Hunt,20,daniel.hunt@example.com -idwrwv2uu4hcpv2i,Roberta Johnson,48,roberta.johnson@example.com -2yd2hd6auetjacyo,Jason Williamson,39,jason.williamson@example.com -egrmdbibnjhi914x,Sandra Robinson,50,sandra.robinson@example.com -15m1pz2bb0ercgyk,Steve Rice,25,steve.rice@example.com -0i21bhkxdagjurb7,Kimberly Fritz,53,kimberly.fritz@example.com -726ofi7h5snreq67,Brianna Reynolds,33,brianna.reynolds@example.com -csqxse3wym56eim6,Alexander Williams,50,alexander.williams@example.com -qeaoylnrsf8p3byg,Andrew Thomas,25,andrew.thomas@example.com -edsswobumzyzbvhf,Austin Williams,57,austin.williams@example.com -hdzhzpt0ahy5hkib,Nicholas Williams,24,nicholas.williams@example.com -w1qmvmg4roa8xnwu,Mrs. Michelle Cisneros,48,michelle.cisneros@example.com -3z3o73x7adyuo6w0,Stacey Smith,39,stacey.smith@example.com -sse2u5zlgoqrgmcf,Laura Beck,20,laura.beck@example.com -rvovijmvch58r4yx,Molly Clark,51,molly.clark@example.com -doe06nrx8sg5mcuv,Carmen Morris,41,carmen.morris@example.com -jbjdwuvj5s4kw04y,Amanda Munoz,20,amanda.munoz@example.com -6k2ewkla7js0yw23,Rachel Collins,44,rachel.collins@example.com -fcxuyr4kkhrnigu1,John Alexander,18,john.alexander@example.com -d25fuwlos5mk07o0,Stacy Hunter,22,stacy.hunter@example.com -1vdai2rxmwd57oet,Eric Massey,40,eric.massey@example.com -pq4jnt9izu1wlrzd,Scott Garcia,20,scott.garcia@example.com -lz9kfc0lty5xcz14,Cassandra Nelson,35,cassandra.nelson@example.com -pu7w6tyab5jd4we9,Aaron Johnson,50,aaron.johnson@example.com -8dupswd2kqwdyn8v,Shannon Sherman,45,shannon.sherman@example.com -ye466l71jthiz2p6,April Garcia,60,april.garcia@example.com -xogsmfwb73l16qdt,Evan Lynn,20,evan.lynn@example.com +$id,name,age,email +r5ctmrqwqn1m3rc0,Diamond Mendez,56,diamond.mendez@example.com +wxwp7e7q7nx3ltfx,Michael Huff,20,michael.huff@example.com +4ct0b38fwaojawlv,Alyssa Rodriguez,37,alyssa.rodriguez@example.com +o0jjcuygbta2zvga,Barbara Smith,26,barbara.smith@example.com +bdy6l2ofl8klb4pb,Evelyn Edwards,54,evelyn.edwards@example.com +rkccl72v7zwtbila,Tina Richardson,41,tina.richardson@example.com +cilw7um0cd927esj,Joel Hernandez,49,joel.hernandez@example.com +60povvz0votkve1j,Zachary Cooper,59,zachary.cooper@example.com +ayow5dzwktvbbtp2,Brittany Spears,20,brittany.spears@example.com +cfru98od0lab0b2n,Holly White,47,holly.white@example.com +vjxjldvu3r6uylq6,Kimberly Barnes,27,kimberly.barnes@example.com +d1p47hl97pw6xowb,Stephen Miller,53,stephen.miller@example.com +yxk6qaa5ryb3gqrb,Yvonne Newman,41,yvonne.newman@example.com +ifkeo7j8t7hfd7z8,Carol Kane,38,carol.kane@example.com +e1q4lq8vvpxp9ysb,Doris Foster,44,doris.foster@example.com +obec6d52dc6swzsf,Joseph Stokes,28,joseph.stokes@example.com +26v06la6ug8wkvim,Steve Williams,31,steve.williams@example.com +m4glre4ch12vkxp6,James Carey,29,james.carey@example.com +jee8fyfffnjugsd5,Kathryn Henry,38,kathryn.henry@example.com +miquc6ljb9l3a31r,Christopher Landry,23,christopher.landry@example.com +ghf7da7seeuj1zdl,Jennifer Mcgee,62,jennifer.mcgee@example.com +x7h11phjrz77w0q8,Cathy Church,35,cathy.church@example.com +dn8u5lsux4708z6j,Jose Lopez,41,jose.lopez@example.com +zb7fdlyohuyy5i9k,William Rose,30,william.rose@example.com +qyrj8m9krp4dt4wt,Sarah Ford,26,sarah.ford@example.com +t6t673zpfyhhz8pg,Alisha Jones,61,alisha.jones@example.com +0hfbo0iy1q9bwc2n,Kristin Kelly,61,kristin.kelly@example.com +8alv4e4xrpcj443z,Brendan Stout,40,brendan.stout@example.com +qxm7a0z32xdkzxdj,Kelly Cruz,18,kelly.cruz@example.com +885mti7j7oiz5p5g,Samantha Martin,50,samantha.martin@example.com +v8i7dvhby6711m66,David Santos,46,david.santos@example.com +rggc0ow8ccd2jgvp,Elizabeth Carroll,22,elizabeth.carroll@example.com +012472s64rvzq1c4,Corey Owens,46,corey.owens@example.com +0k2xrwj4g33ut14y,Shelby Mueller,65,shelby.mueller@example.com +s3y9rl4uzf3difiq,Dr. Sylvia Myers,29,sylvia.myers@example.com +ntpc2td892t7f6an,Scott Freeman,48,scott.freeman@example.com +7f703gibyr5ijdmt,Christopher Atkinson,21,christopher.atkinson@example.com +r2jdf2pivkxmqd0l,Sean Diaz,31,sean.diaz@example.com +fj98fji1lrxeigs9,Bobby Dyer,57,bobby.dyer@example.com +mehqmzp9u7xv1z3j,Daniel Hall,62,daniel.hall@example.com +4cd5ln65qjfv3h4j,Jennifer Ramirez,65,jennifer.ramirez@example.com +wdi6ap0oa7m1ab1d,Angela Jackson,57,angela.jackson@example.com +l2foqjhxvjhjzijb,Kelly Lewis,36,kelly.lewis@example.com +d963t5yu35uagwm4,Jessica Munoz,55,jessica.munoz@example.com +99ez9uxsim8zp64m,Kelly George,65,kelly.george@example.com +v7wl221gycftl63d,Anthony Johnson,65,anthony.johnson@example.com +p2zzj0lnmjvqzfc3,Regina Fields,61,regina.fields@example.com +fk655e243z2ivvx6,Sharon Schaefer,30,sharon.schaefer@example.com +4ywsv6fw8g2d8ncw,Jacob French,62,jacob.french@example.com +y61q9k6g4h0fxxz4,Jessica Costa,23,jessica.costa@example.com +knj4hfzsthk7vx5n,George Hardy,53,george.hardy@example.com +a88u9w2pct2nn8l6,Andrea Allison,20,andrea.allison@example.com +hw960v1ybycrwr5o,Kevin Ferguson,32,kevin.ferguson@example.com +j9garslpgx6jgzgb,Joseph Johnson,58,joseph.johnson@example.com +gv101bz36elm84cd,Ashley Martinez,18,ashley.martinez@example.com +xrvzgt3gc0c7g4cl,Charles Nixon,23,charles.nixon@example.com +awjlu7uk0eutcfpb,Carol Dudley,40,carol.dudley@example.com +95oi26p2zdudpime,David Weber,51,david.weber@example.com +h8x7pkhdvu5bcp89,Scott Robinson,32,scott.robinson@example.com +oj6cu4jm1z2afe7s,Anthony Hardy,38,anthony.hardy@example.com +hgsdi1g30poqqmf0,Mackenzie Owens,52,mackenzie.owens@example.com +8fzdz914bqlqk2tc,Brian Foster,27,brian.foster@example.com +fwlqoeiunjhczpl0,Hannah Forbes,56,hannah.forbes@example.com +rsv8156goe8z4j6j,Lauren Reed,26,lauren.reed@example.com +1fjqv3w7uwbswe2p,Morgan Smith,28,morgan.smith@example.com +soqrzmhhg05hhzn4,Samantha Alexander,65,samantha.alexander@example.com +8quy52cto9kjjokp,Tiffany Roberts,20,tiffany.roberts@example.com +e3i1g1lw04v7jd89,Emily Hayes,34,emily.hayes@example.com +s7n8lzb0sw7h93z1,Rebecca Villegas,52,rebecca.villegas@example.com +e2lc7i81tpkqs1rp,Donald Shah,61,donald.shah@example.com +3oe2mysup1xluiw0,Denise Cain,59,denise.cain@example.com +1vqypc37f85nuqz4,Kristine Ramirez,53,kristine.ramirez@example.com +m0uh7r3dc6z8ucb4,Stacey Adkins,61,stacey.adkins@example.com +jdofz6x1ahganmqf,Daniel Hunt,20,daniel.hunt@example.com +vbe903c2q4m4q97g,Roberta Johnson,48,roberta.johnson@example.com +sndngrxuwpd93pdb,Jason Williamson,39,jason.williamson@example.com +66hvaw2p5xwf07p8,Sandra Robinson,50,sandra.robinson@example.com +9pvingfsl8cmag5c,Steve Rice,25,steve.rice@example.com +qe154m5hh00u4iiz,Kimberly Fritz,53,kimberly.fritz@example.com +avqnbrco2f0tfupk,Brianna Reynolds,33,brianna.reynolds@example.com +cqs10gi2qu1r3ugb,Alexander Williams,50,alexander.williams@example.com +jrpmfi6hmm7pmegp,Andrew Thomas,25,andrew.thomas@example.com +heeab2qqf0zm446f,Austin Williams,57,austin.williams@example.com +bkhugvnil7kjchm6,Nicholas Williams,24,nicholas.williams@example.com +b045j302pvv8l1p4,Mrs. Michelle Cisneros,48,michelle.cisneros@example.com +aikhii5q210lrfpr,Stacey Smith,39,stacey.smith@example.com +x0zajitea1z2dfo0,Laura Beck,20,laura.beck@example.com +abeecki7mdff1tv0,Molly Clark,51,molly.clark@example.com +yizama8r3i1to548,Carmen Morris,41,carmen.morris@example.com +8690yh971g4rgspj,Amanda Munoz,20,amanda.munoz@example.com +cd9vk5v97t359ul2,Rachel Collins,44,rachel.collins@example.com +wrkgmx1v0w9ja4l8,John Alexander,18,john.alexander@example.com +kxp3ucqo6ped4ss7,Stacy Hunter,22,stacy.hunter@example.com +dbvv8okae2qgo0gm,Eric Massey,40,eric.massey@example.com +9tn3nm6ppnayisje,Scott Garcia,20,scott.garcia@example.com +1xuc5t60xpcvd4qi,Cassandra Nelson,35,cassandra.nelson@example.com +qao1nulwn0kqyfkc,Aaron Johnson,50,aaron.johnson@example.com +kd2q6owvuwsy5knx,Shannon Sherman,45,shannon.sherman@example.com +wsl37kjo0bib4wrc,April Garcia,60,april.garcia@example.com +ujlz7k84xzfx4khs,Evan Lynn,20,evan.lynn@example.com From 2b3a8527ff65aa4e1f3259982d6103ab81789c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 8 Aug 2025 17:15:14 +0200 Subject: [PATCH 05/16] Make functions worker customizable --- app/cli.php | 3 +++ app/controllers/api/health.php | 6 +++--- app/init/resources.php | 6 ++++++ app/worker.php | 8 ++++++++ src/Appwrite/Platform/Tasks/ScheduleBase.php | 5 ++++- src/Appwrite/Platform/Tasks/ScheduleExecutions.php | 2 +- src/Appwrite/Platform/Tasks/ScheduleFunctions.php | 2 +- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/cli.php b/app/cli.php index 504e4fb5e6..2ad37c0ce2 100644 --- a/app/cli.php +++ b/app/cli.php @@ -194,6 +194,9 @@ CLI::setResource('publisher', function (Group $pools) { CLI::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +CLI::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); CLI::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 39ebae9590..b86ed286f2 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -686,12 +686,12 @@ App::get('/v1/health/queue/functions') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisher') + ->inject('publisherForFunctions') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisher, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherForFunctions, Response $response) { $threshold = \intval($threshold); - $size = $publisher->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); + $size = $publisherForFunctions->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); diff --git a/app/init/resources.php b/app/init/resources.php index 162eab1973..1d3b25062c 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -83,6 +83,9 @@ App::setResource('publisher', function (Group $pools) { App::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +App::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); App::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -95,6 +98,9 @@ App::setResource('consumer', function (Group $pools) { App::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); +App::setResource('consumerFunctions', function (BrokerPool $consumer) { + return $consumer; +}, ['consumer']); App::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['publisher']); diff --git a/app/worker.php b/app/worker.php index 90f3368fe7..cc8aca2d8e 100644 --- a/app/worker.php +++ b/app/worker.php @@ -251,6 +251,10 @@ Server::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +Server::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); + Server::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -267,6 +271,10 @@ Server::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); +Server::setResource('consumerFunctions', function (BrokerPool $consumer) { + return $consumer; +}, ['consumer']); + Server::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 222051a67f..1710f0163d 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -26,6 +26,7 @@ abstract class ScheduleBase extends Action protected BrokerPool $publisher; protected BrokerPool $publisherMigrations; + protected BrokerPool $publisherFunctions; private ?Histogram $collectSchedulesTelemetryDuration = null; private ?Gauge $collectSchedulesTelemetryCount = null; @@ -45,6 +46,7 @@ abstract class ScheduleBase extends Action ->desc("Execute {$type}s scheduled in Appwrite") ->inject('publisher') ->inject('publisherMigrations') + ->inject('publisherFunctions') ->inject('dbForPlatform') ->inject('getProjectDB') ->inject('telemetry') @@ -67,13 +69,14 @@ abstract class ScheduleBase extends Action * 2. Create timer that sync all changes from 'schedules' collection to local copy. Only reading changes thanks to 'resourceUpdatedAt' attribute * 3. Create timer that prepares coroutines for soon-to-execute schedules. When it's ready, coroutine sleeps until exact time before sending request to worker. */ - public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void + public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, BrokerPool $publisherFunctions, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void { Console::title(\ucfirst(static::getSupportedResource()) . ' scheduler V1'); Console::success(APP_NAME . ' ' . \ucfirst(static::getSupportedResource()) . ' scheduler v1 has started'); $this->publisher = $publisher; $this->publisherMigrations = $publisherMigrations; + $this->publisherFunctions = $publisherFunctions; $this->scheduleTelemetryCount = $telemetry->createGauge('task.schedule.count'); $this->collectSchedulesTelemetryDuration = $telemetry->createHistogram('task.schedule.collect_schedules.duration', 's'); diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 96a5a05f0e..14a4259e17 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -30,7 +30,7 @@ class ScheduleExecutions extends ScheduleBase { $intervalEnd = (new \DateTime())->modify('+' . self::ENQUEUE_TIMER . ' seconds'); - $queueForFunctions = new Func($this->publisher); + $queueForFunctions = new Func($this->publisherFunctions); foreach ($this->schedules as $schedule) { if (!$schedule['active']) { diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 43f1025c08..6f072425e4 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -90,7 +90,7 @@ class ScheduleFunctions extends ScheduleBase $this->updateProjectAccess($schedule['project'], $dbForPlatform); - $queueForFunctions = new Func($this->publisher); + $queueForFunctions = new Func($this->publisherFunctions); $queueForFunctions ->setType('schedule') From 9a6c4c5ebea77f52db239e172183e5abca6491a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 8 Aug 2025 17:21:31 +0200 Subject: [PATCH 06/16] Fix typo --- app/controllers/api/health.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index b86ed286f2..32b77433f0 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -686,12 +686,12 @@ App::get('/v1/health/queue/functions') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisherForFunctions') + ->inject('publisherFunctions') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisherForFunctions, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherFunctions, Response $response) { $threshold = \intval($threshold); - $size = $publisherForFunctions->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); + $size = $publisherFunctions->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); From 913fa9d0643b085590795d6856565d4471a991f0 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Fri, 8 Aug 2025 21:50:11 +0530 Subject: [PATCH 07/16] Update build command for flutter --- app/config/templates/site.php | 2 +- docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/templates/site.php b/app/config/templates/site.php index 4ae6f61607..6be0effc5d 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -473,7 +473,7 @@ return [ 'frameworks' => [ getFramework('FLUTTER', [ 'providerRootDirectory' => './', - 'buildCommand' => 'bash build.sh', + 'buildCommand' => 'bash prepare-env.sh && flutter build web', ]), ], 'vcsProvider' => 'github', diff --git a/docker-compose.yml b/docker-compose.yml index 0e299c8a2c..d3abcbf04f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -216,7 +216,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:6.1.12 + image: appwrite/console:6.1.27 restart: unless-stopped networks: - appwrite From b89d713002d2430d0a14756c1003ecf999ca023a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 11 Aug 2025 07:01:06 +0000 Subject: [PATCH 08/16] Purge collection cache alongside document cache in database operations Co-authored-by: jakeb994 --- src/Appwrite/Platform/Workers/Databases.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Databases.php b/src/Appwrite/Platform/Workers/Databases.php index 896ec6d32d..f7940dd920 100644 --- a/src/Appwrite/Platform/Workers/Databases.php +++ b/src/Appwrite/Platform/Workers/Databases.php @@ -225,9 +225,11 @@ class Databases extends Action if (! $relatedCollection->isEmpty()) { $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $relatedCollection->getId()); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence()); } $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $collectionId); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); } } @@ -383,9 +385,11 @@ class Databases extends Action } } finally { $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $collectionId); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); if (! $relatedCollection->isEmpty()) { $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $relatedCollection->getId()); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $relatedCollection->getSequence()); } } } @@ -444,6 +448,7 @@ class Databases extends Action } finally { $this->trigger($database, $collection, $project, $event, $queueForRealtime, null, $index); $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $collectionId); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); } } @@ -500,6 +505,7 @@ class Databases extends Action } finally { $this->trigger($database, $collection, $project, $event, $queueForRealtime, null, $index); $dbForProject->purgeCachedDocument('database_' . $database->getSequence(), $collection->getId()); + $dbForProject->purgeCachedCollection('database_' . $database->getSequence() . '_collection_' . $collection->getSequence()); } } From 7a0b34474f50379ce7bddef58e4279013b878c19 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 11 Aug 2025 21:26:10 +1200 Subject: [PATCH 09/16] Skip redundant subqueries in users list route --- app/controllers/api/users.php | 23 ++++--- composer.json | 2 +- composer.lock | 118 ++++++++++++++++++++++------------ 3 files changed, 92 insertions(+), 51 deletions(-) diff --git a/app/controllers/api/users.php b/app/controllers/api/users.php index b3ae17dc91..9163db0588 100644 --- a/app/controllers/api/users.php +++ b/app/controllers/api/users.php @@ -643,15 +643,20 @@ App::get('/v1/users') $cursor->setValue($cursorDocument); } - $filterQueries = Query::groupByType($queries)['filters']; - try { - $users = $dbForProject->find('users', $queries); - $total = $dbForProject->count('users', $filterQueries, APP_LIMIT_COUNT); - } catch (OrderException $e) { - throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); - } catch (QueryException $e) { - throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); - } + $users = []; + $total = 0; + + $dbForProject->skipFilters(function () use ($dbForProject, $queries, &$users, &$total) { + try { + $users = $dbForProject->find('users', $queries); + $total = $dbForProject->count('users', $queries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + }, ['subQueryAuthenticators', 'subQuerySessions', 'subQueryTokens', 'subQueryChallenges', 'subQueryMemberships']); + $response->dynamic(new Document([ 'users' => $users, 'total' => $total, diff --git a/composer.json b/composer.json index 8ba8e49f4a..98ea37269c 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.71.*", + "utopia-php/database": "0.77.*", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dns": "0.3.*", diff --git a/composer.lock b/composer.lock index ebec5b0077..960f6db16d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "761a7e17b49381e68038c92873888125", + "content-hash": "ffde336019860214fbe370366fd08d3f", "packages": [ { "name": "adhocore/jwt", @@ -3545,16 +3545,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.12", + "version": "0.77.3", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "72c2a9c185f0f606e4792913a071f744cca21d42" + "reference": "61dd323c1566b0bad43acc23b059e5e7de7561c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/72c2a9c185f0f606e4792913a071f744cca21d42", - "reference": "72c2a9c185f0f606e4792913a071f744cca21d42", + "url": "https://api.github.com/repos/utopia-php/database/zipball/61dd323c1566b0bad43acc23b059e5e7de7561c9", + "reference": "61dd323c1566b0bad43acc23b059e5e7de7561c9", "shasum": "" }, "require": { @@ -3595,9 +3595,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.71.12" + "source": "https://github.com/utopia-php/database/tree/0.77.3" }, - "time": "2025-08-05T09:38:25+00:00" + "time": "2025-08-11T09:02:07+00:00" }, { "name": "utopia-php/detector", @@ -4101,16 +4101,16 @@ }, { "name": "utopia-php/migration", - "version": "0.11.4", + "version": "0.11.3", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "e924e6535c4368abd778252da6fa96e423412c67" + "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/e924e6535c4368abd778252da6fa96e423412c67", - "reference": "e924e6535c4368abd778252da6fa96e423412c67", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/fb14e0e35061bfec2656200e3d02a3bdf569a0ac", + "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac", "shasum": "" }, "require": { @@ -4118,7 +4118,7 @@ "ext-curl": "*", "ext-openssl": "*", "php": ">=8.1", - "utopia-php/database": "0.71.*", + "utopia-php/database": "0.*.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", "utopia-php/storage": "0.18.*" @@ -4151,9 +4151,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.11.4" + "source": "https://github.com/utopia-php/migration/tree/0.11.3" }, - "time": "2025-08-08T11:22:24+00:00" + "time": "2025-07-30T11:20:31+00:00" }, { "name": "utopia-php/orchestration", @@ -6147,16 +6147,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.23", + "version": "9.6.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" + "reference": "ea49afa29aeea25ea7bf9de9fdd7cab163cc0701" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea49afa29aeea25ea7bf9de9fdd7cab163cc0701", + "reference": "ea49afa29aeea25ea7bf9de9fdd7cab163cc0701", "shasum": "" }, "require": { @@ -6167,7 +6167,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.1", + "myclabs/deep-copy": "^1.13.4", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -6178,11 +6178,11 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", + "sebastian/comparator": "^4.0.9", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", + "sebastian/global-state": "^5.0.8", "sebastian/object-enumerator": "^4.0.4", "sebastian/resource-operations": "^3.0.4", "sebastian/type": "^3.2.1", @@ -6230,7 +6230,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.24" }, "funding": [ { @@ -6254,7 +6254,7 @@ "type": "tidelift" } ], - "time": "2025-05-02T06:40:34+00:00" + "time": "2025-08-10T08:32:42+00:00" }, { "name": "psr/cache", @@ -6474,16 +6474,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "4.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", "shasum": "" }, "require": { @@ -6536,15 +6536,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-08-10T06:51:50+00:00" }, { "name": "sebastian/complexity", @@ -6811,16 +6823,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", "shasum": "" }, "require": { @@ -6863,15 +6875,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2025-08-10T07:10:35+00:00" }, { "name": "sebastian/lines-of-code", @@ -7044,16 +7068,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", "shasum": "" }, "require": { @@ -7095,15 +7119,27 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2025-08-10T06:57:39+00:00" }, { "name": "sebastian/resource-operations", From 4da9b99414a7a487d6cbf97275aee09841c92746 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Mon, 11 Aug 2025 16:11:58 +0530 Subject: [PATCH 10/16] Bump flutter starter version --- app/config/templates/site.php | 2 +- composer.lock | 90 ++++++++++++++++++++++++----------- docker-compose.yml | 2 +- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/app/config/templates/site.php b/app/config/templates/site.php index 6be0effc5d..95a2161902 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -479,7 +479,7 @@ return [ 'vcsProvider' => 'github', 'providerRepositoryId' => 'starter-for-flutter', 'providerOwner' => 'appwrite', - 'providerVersion' => '0.1.*', + 'providerVersion' => '0.2.*', 'variables' => [ [ 'name' => 'APPWRITE_PUBLIC_ENDPOINT', diff --git a/composer.lock b/composer.lock index ebec5b0077..aa8fd0ab90 100644 --- a/composer.lock +++ b/composer.lock @@ -6147,16 +6147,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.23", + "version": "9.6.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95" + "reference": "ea49afa29aeea25ea7bf9de9fdd7cab163cc0701" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", - "reference": "43d2cb18d0675c38bd44982a5d1d88f6d53d8d95", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ea49afa29aeea25ea7bf9de9fdd7cab163cc0701", + "reference": "ea49afa29aeea25ea7bf9de9fdd7cab163cc0701", "shasum": "" }, "require": { @@ -6167,7 +6167,7 @@ "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.13.1", + "myclabs/deep-copy": "^1.13.4", "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=7.3", @@ -6178,11 +6178,11 @@ "phpunit/php-timer": "^5.0.3", "sebastian/cli-parser": "^1.0.2", "sebastian/code-unit": "^1.0.8", - "sebastian/comparator": "^4.0.8", + "sebastian/comparator": "^4.0.9", "sebastian/diff": "^4.0.6", "sebastian/environment": "^5.1.5", "sebastian/exporter": "^4.0.6", - "sebastian/global-state": "^5.0.7", + "sebastian/global-state": "^5.0.8", "sebastian/object-enumerator": "^4.0.4", "sebastian/resource-operations": "^3.0.4", "sebastian/type": "^3.2.1", @@ -6230,7 +6230,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.23" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.24" }, "funding": [ { @@ -6254,7 +6254,7 @@ "type": "tidelift" } ], - "time": "2025-05-02T06:40:34+00:00" + "time": "2025-08-10T08:32:42+00:00" }, { "name": "psr/cache", @@ -6474,16 +6474,16 @@ }, { "name": "sebastian/comparator", - "version": "4.0.8", + "version": "4.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a" + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa0f136dd2334583309d32b62544682ee972b51a", - "reference": "fa0f136dd2334583309d32b62544682ee972b51a", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/67a2df3a62639eab2cc5906065e9805d4fd5dfc5", + "reference": "67a2df3a62639eab2cc5906065e9805d4fd5dfc5", "shasum": "" }, "require": { @@ -6536,15 +6536,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.8" + "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.9" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2022-09-14T12:41:17+00:00" + "time": "2025-08-10T06:51:50+00:00" }, { "name": "sebastian/complexity", @@ -6811,16 +6823,16 @@ }, { "name": "sebastian/global-state", - "version": "5.0.7", + "version": "5.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", - "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/b6781316bdcd28260904e7cc18ec983d0d2ef4f6", + "reference": "b6781316bdcd28260904e7cc18ec983d0d2ef4f6", "shasum": "" }, "require": { @@ -6863,15 +6875,27 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.8" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" } ], - "time": "2024-03-02T06:35:11+00:00" + "time": "2025-08-10T07:10:35+00:00" }, { "name": "sebastian/lines-of-code", @@ -7044,16 +7068,16 @@ }, { "name": "sebastian/recursion-context", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1" + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", - "reference": "e75bd0f07204fec2a0af9b0f3cfe97d05f92efc1", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/539c6691e0623af6dc6f9c20384c120f963465a0", + "reference": "539c6691e0623af6dc6f9c20384c120f963465a0", "shasum": "" }, "require": { @@ -7095,15 +7119,27 @@ "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.6" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2023-02-03T06:07:39+00:00" + "time": "2025-08-10T06:57:39+00:00" }, { "name": "sebastian/resource-operations", diff --git a/docker-compose.yml b/docker-compose.yml index d3abcbf04f..9b5e7a1fd7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -216,7 +216,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:6.1.27 + image: appwrite/console:6.1.28 restart: unless-stopped networks: - appwrite From 672f642de6ab27ae46946895b1a0505458e3dcbb Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Mon, 11 Aug 2025 23:01:52 +1200 Subject: [PATCH 11/16] Update DB --- composer.json | 2 +- composer.lock | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 98ea37269c..8ba8e49f4a 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.77.*", + "utopia-php/database": "0.71.*", "utopia-php/detector": "0.1.*", "utopia-php/domains": "0.8.*", "utopia-php/dns": "0.3.*", diff --git a/composer.lock b/composer.lock index 960f6db16d..c659e066c1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ffde336019860214fbe370366fd08d3f", + "content-hash": "761a7e17b49381e68038c92873888125", "packages": [ { "name": "adhocore/jwt", @@ -3545,16 +3545,16 @@ }, { "name": "utopia-php/database", - "version": "0.77.3", + "version": "0.71.13", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "61dd323c1566b0bad43acc23b059e5e7de7561c9" + "reference": "43aaba72b5699a06351b25924c3417ff83e6bb4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/61dd323c1566b0bad43acc23b059e5e7de7561c9", - "reference": "61dd323c1566b0bad43acc23b059e5e7de7561c9", + "url": "https://api.github.com/repos/utopia-php/database/zipball/43aaba72b5699a06351b25924c3417ff83e6bb4b", + "reference": "43aaba72b5699a06351b25924c3417ff83e6bb4b", "shasum": "" }, "require": { @@ -3595,9 +3595,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.77.3" + "source": "https://github.com/utopia-php/database/tree/0.71.13" }, - "time": "2025-08-11T09:02:07+00:00" + "time": "2025-08-11T10:47:16+00:00" }, { "name": "utopia-php/detector", @@ -4101,16 +4101,16 @@ }, { "name": "utopia-php/migration", - "version": "0.11.3", + "version": "0.11.4", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac" + "reference": "e924e6535c4368abd778252da6fa96e423412c67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/fb14e0e35061bfec2656200e3d02a3bdf569a0ac", - "reference": "fb14e0e35061bfec2656200e3d02a3bdf569a0ac", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/e924e6535c4368abd778252da6fa96e423412c67", + "reference": "e924e6535c4368abd778252da6fa96e423412c67", "shasum": "" }, "require": { @@ -4118,7 +4118,7 @@ "ext-curl": "*", "ext-openssl": "*", "php": ">=8.1", - "utopia-php/database": "0.*.*", + "utopia-php/database": "0.71.*", "utopia-php/dsn": "0.2.*", "utopia-php/framework": "0.33.*", "utopia-php/storage": "0.18.*" @@ -4151,9 +4151,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/0.11.3" + "source": "https://github.com/utopia-php/migration/tree/0.11.4" }, - "time": "2025-07-30T11:20:31+00:00" + "time": "2025-08-08T11:22:24+00:00" }, { "name": "utopia-php/orchestration", From 7e110bf292fd114ffbf0ef3a5286d62551b42679 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 12 Aug 2025 00:38:41 +1200 Subject: [PATCH 12/16] Revert "Feat: Make functions worker customizable" --- app/cli.php | 3 --- app/controllers/api/health.php | 6 +++--- app/init/resources.php | 6 ------ app/worker.php | 8 -------- src/Appwrite/Platform/Tasks/ScheduleBase.php | 5 +---- src/Appwrite/Platform/Tasks/ScheduleExecutions.php | 2 +- src/Appwrite/Platform/Tasks/ScheduleFunctions.php | 2 +- 7 files changed, 6 insertions(+), 26 deletions(-) diff --git a/app/cli.php b/app/cli.php index 2ad37c0ce2..504e4fb5e6 100644 --- a/app/cli.php +++ b/app/cli.php @@ -194,9 +194,6 @@ CLI::setResource('publisher', function (Group $pools) { CLI::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -CLI::setResource('publisherFunctions', function (BrokerPool $publisher) { - return $publisher; -}, ['publisher']); CLI::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 32b77433f0..39ebae9590 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -686,12 +686,12 @@ App::get('/v1/health/queue/functions') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisherFunctions') + ->inject('publisher') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisherFunctions, Response $response) { + ->action(function (int|string $threshold, Publisher $publisher, Response $response) { $threshold = \intval($threshold); - $size = $publisherFunctions->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); + $size = $publisher->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); diff --git a/app/init/resources.php b/app/init/resources.php index 1d3b25062c..162eab1973 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -83,9 +83,6 @@ App::setResource('publisher', function (Group $pools) { App::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -App::setResource('publisherFunctions', function (BrokerPool $publisher) { - return $publisher; -}, ['publisher']); App::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -98,9 +95,6 @@ App::setResource('consumer', function (Group $pools) { App::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); -App::setResource('consumerFunctions', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); App::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['publisher']); diff --git a/app/worker.php b/app/worker.php index cc8aca2d8e..90f3368fe7 100644 --- a/app/worker.php +++ b/app/worker.php @@ -251,10 +251,6 @@ Server::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); -Server::setResource('publisherFunctions', function (BrokerPool $publisher) { - return $publisher; -}, ['publisher']); - Server::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -271,10 +267,6 @@ Server::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); -Server::setResource('consumerFunctions', function (BrokerPool $consumer) { - return $consumer; -}, ['consumer']); - Server::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 1710f0163d..222051a67f 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -26,7 +26,6 @@ abstract class ScheduleBase extends Action protected BrokerPool $publisher; protected BrokerPool $publisherMigrations; - protected BrokerPool $publisherFunctions; private ?Histogram $collectSchedulesTelemetryDuration = null; private ?Gauge $collectSchedulesTelemetryCount = null; @@ -46,7 +45,6 @@ abstract class ScheduleBase extends Action ->desc("Execute {$type}s scheduled in Appwrite") ->inject('publisher') ->inject('publisherMigrations') - ->inject('publisherFunctions') ->inject('dbForPlatform') ->inject('getProjectDB') ->inject('telemetry') @@ -69,14 +67,13 @@ abstract class ScheduleBase extends Action * 2. Create timer that sync all changes from 'schedules' collection to local copy. Only reading changes thanks to 'resourceUpdatedAt' attribute * 3. Create timer that prepares coroutines for soon-to-execute schedules. When it's ready, coroutine sleeps until exact time before sending request to worker. */ - public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, BrokerPool $publisherFunctions, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void + public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void { Console::title(\ucfirst(static::getSupportedResource()) . ' scheduler V1'); Console::success(APP_NAME . ' ' . \ucfirst(static::getSupportedResource()) . ' scheduler v1 has started'); $this->publisher = $publisher; $this->publisherMigrations = $publisherMigrations; - $this->publisherFunctions = $publisherFunctions; $this->scheduleTelemetryCount = $telemetry->createGauge('task.schedule.count'); $this->collectSchedulesTelemetryDuration = $telemetry->createHistogram('task.schedule.collect_schedules.duration', 's'); diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 14a4259e17..96a5a05f0e 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -30,7 +30,7 @@ class ScheduleExecutions extends ScheduleBase { $intervalEnd = (new \DateTime())->modify('+' . self::ENQUEUE_TIMER . ' seconds'); - $queueForFunctions = new Func($this->publisherFunctions); + $queueForFunctions = new Func($this->publisher); foreach ($this->schedules as $schedule) { if (!$schedule['active']) { diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 6f072425e4..43f1025c08 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -90,7 +90,7 @@ class ScheduleFunctions extends ScheduleBase $this->updateProjectAccess($schedule['project'], $dbForPlatform); - $queueForFunctions = new Func($this->publisherFunctions); + $queueForFunctions = new Func($this->publisher); $queueForFunctions ->setType('schedule') From ee13066f18cd08525e776ae72854d3282b5f5bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 11 Aug 2025 15:06:23 +0200 Subject: [PATCH 13/16] Fix missing place not using proper publisher --- app/controllers/shared/api.php | 6 ++++-- composer.lock | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 2ef992764f..6bc90034d4 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -6,6 +6,7 @@ use Appwrite\Auth\MFA\Type\TOTP; use Appwrite\Event\Audit; use Appwrite\Event\Build; use Appwrite\Event\Database as EventDatabase; +use Utopia\Queue\Broker\Pool as BrokerPool; use Appwrite\Event\Delete; use Appwrite\Event\Event; use Appwrite\Event\Func; @@ -408,6 +409,7 @@ App::init() ->inject('project') ->inject('user') ->inject('publisher') + ->inject('publisherFunctions') ->inject('queueForEvents') ->inject('queueForMessaging') ->inject('queueForAudits') @@ -423,7 +425,7 @@ App::init() ->inject('plan') ->inject('devKey') ->inject('telemetry') - ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Telemetry $telemetry) use ($usageDatabaseListener, $eventDatabaseListener) { + ->action(function (App $utopia, Request $request, Response $response, Document $project, Document $user, Publisher $publisher, BrokerPool $publisherFunctions, Event $queueForEvents, Messaging $queueForMessaging, Audit $queueForAudits, Delete $queueForDeletes, EventDatabase $queueForDatabase, Build $queueForBuilds, StatsUsage $queueForStatsUsage, Database $dbForProject, callable $timelimit, Document $resourceToken, string $mode, ?Key $apiKey, array $plan, Document $devKey, Telemetry $telemetry) use ($usageDatabaseListener, $eventDatabaseListener) { $route = $utopia->getRoute(); @@ -535,7 +537,7 @@ App::init() // Clone the queues, to prevent events triggered by the database listener // from overwriting the events that are supposed to be triggered in the shutdown hook. $queueForEventsClone = new Event($publisher); - $queueForFunctions = new Func($publisher); + $queueForFunctions = new Func($publisherFunctions); $queueForWebhooks = new Webhook($publisher); $queueForRealtime = new Realtime(); diff --git a/composer.lock b/composer.lock index c659e066c1..117e91b621 100644 --- a/composer.lock +++ b/composer.lock @@ -8403,7 +8403,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -8427,5 +8427,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.3.0" } From 3efd9a778e727ed6e1a0d2cea74b70006d99778d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 11 Aug 2025 15:07:05 +0200 Subject: [PATCH 14/16] Reapply "Feat: Make functions worker customizable" This reverts commit 7e110bf292fd114ffbf0ef3a5286d62551b42679. --- app/cli.php | 3 +++ app/controllers/api/health.php | 6 +++--- app/init/resources.php | 6 ++++++ app/worker.php | 8 ++++++++ src/Appwrite/Platform/Tasks/ScheduleBase.php | 5 ++++- src/Appwrite/Platform/Tasks/ScheduleExecutions.php | 2 +- src/Appwrite/Platform/Tasks/ScheduleFunctions.php | 2 +- 7 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/cli.php b/app/cli.php index 504e4fb5e6..2ad37c0ce2 100644 --- a/app/cli.php +++ b/app/cli.php @@ -194,6 +194,9 @@ CLI::setResource('publisher', function (Group $pools) { CLI::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +CLI::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); CLI::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php index 39ebae9590..32b77433f0 100644 --- a/app/controllers/api/health.php +++ b/app/controllers/api/health.php @@ -686,12 +686,12 @@ App::get('/v1/health/queue/functions') contentType: ContentType::JSON )) ->param('threshold', 5000, new Integer(true), 'Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000.', true) - ->inject('publisher') + ->inject('publisherFunctions') ->inject('response') - ->action(function (int|string $threshold, Publisher $publisher, Response $response) { + ->action(function (int|string $threshold, Publisher $publisherFunctions, Response $response) { $threshold = \intval($threshold); - $size = $publisher->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); + $size = $publisherFunctions->getQueueSize(new Queue(Event::FUNCTIONS_QUEUE_NAME)); if ($size >= $threshold) { throw new Exception(Exception::HEALTH_QUEUE_SIZE_EXCEEDED, "Queue size threshold hit. Current size is {$size} and threshold is {$threshold}."); diff --git a/app/init/resources.php b/app/init/resources.php index 162eab1973..1d3b25062c 100644 --- a/app/init/resources.php +++ b/app/init/resources.php @@ -83,6 +83,9 @@ App::setResource('publisher', function (Group $pools) { App::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +App::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); App::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -95,6 +98,9 @@ App::setResource('consumer', function (Group $pools) { App::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); +App::setResource('consumerFunctions', function (BrokerPool $consumer) { + return $consumer; +}, ['consumer']); App::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['publisher']); diff --git a/app/worker.php b/app/worker.php index 90f3368fe7..cc8aca2d8e 100644 --- a/app/worker.php +++ b/app/worker.php @@ -251,6 +251,10 @@ Server::setResource('publisherDatabases', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); +Server::setResource('publisherFunctions', function (BrokerPool $publisher) { + return $publisher; +}, ['publisher']); + Server::setResource('publisherMigrations', function (BrokerPool $publisher) { return $publisher; }, ['publisher']); @@ -267,6 +271,10 @@ Server::setResource('consumerDatabases', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); +Server::setResource('consumerFunctions', function (BrokerPool $consumer) { + return $consumer; +}, ['consumer']); + Server::setResource('consumerMigrations', function (BrokerPool $consumer) { return $consumer; }, ['consumer']); diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 222051a67f..1710f0163d 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -26,6 +26,7 @@ abstract class ScheduleBase extends Action protected BrokerPool $publisher; protected BrokerPool $publisherMigrations; + protected BrokerPool $publisherFunctions; private ?Histogram $collectSchedulesTelemetryDuration = null; private ?Gauge $collectSchedulesTelemetryCount = null; @@ -45,6 +46,7 @@ abstract class ScheduleBase extends Action ->desc("Execute {$type}s scheduled in Appwrite") ->inject('publisher') ->inject('publisherMigrations') + ->inject('publisherFunctions') ->inject('dbForPlatform') ->inject('getProjectDB') ->inject('telemetry') @@ -67,13 +69,14 @@ abstract class ScheduleBase extends Action * 2. Create timer that sync all changes from 'schedules' collection to local copy. Only reading changes thanks to 'resourceUpdatedAt' attribute * 3. Create timer that prepares coroutines for soon-to-execute schedules. When it's ready, coroutine sleeps until exact time before sending request to worker. */ - public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void + public function action(BrokerPool $publisher, BrokerPool $publisherMigrations, BrokerPool $publisherFunctions, Database $dbForPlatform, callable $getProjectDB, Telemetry $telemetry): void { Console::title(\ucfirst(static::getSupportedResource()) . ' scheduler V1'); Console::success(APP_NAME . ' ' . \ucfirst(static::getSupportedResource()) . ' scheduler v1 has started'); $this->publisher = $publisher; $this->publisherMigrations = $publisherMigrations; + $this->publisherFunctions = $publisherFunctions; $this->scheduleTelemetryCount = $telemetry->createGauge('task.schedule.count'); $this->collectSchedulesTelemetryDuration = $telemetry->createHistogram('task.schedule.collect_schedules.duration', 's'); diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 96a5a05f0e..14a4259e17 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -30,7 +30,7 @@ class ScheduleExecutions extends ScheduleBase { $intervalEnd = (new \DateTime())->modify('+' . self::ENQUEUE_TIMER . ' seconds'); - $queueForFunctions = new Func($this->publisher); + $queueForFunctions = new Func($this->publisherFunctions); foreach ($this->schedules as $schedule) { if (!$schedule['active']) { diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 43f1025c08..6f072425e4 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -90,7 +90,7 @@ class ScheduleFunctions extends ScheduleBase $this->updateProjectAccess($schedule['project'], $dbForPlatform); - $queueForFunctions = new Func($this->publisher); + $queueForFunctions = new Func($this->publisherFunctions); $queueForFunctions ->setType('schedule') From b641c9e5e0de4fff32f4b0bb839375d5485ffd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 11 Aug 2025 15:13:57 +0200 Subject: [PATCH 15/16] Linter fix --- app/controllers/shared/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shared/api.php b/app/controllers/shared/api.php index 6bc90034d4..1acf2c8ea6 100644 --- a/app/controllers/shared/api.php +++ b/app/controllers/shared/api.php @@ -6,7 +6,6 @@ use Appwrite\Auth\MFA\Type\TOTP; use Appwrite\Event\Audit; use Appwrite\Event\Build; use Appwrite\Event\Database as EventDatabase; -use Utopia\Queue\Broker\Pool as BrokerPool; use Appwrite\Event\Delete; use Appwrite\Event\Event; use Appwrite\Event\Func; @@ -30,6 +29,7 @@ use Utopia\Database\DateTime; use Utopia\Database\Document; use Utopia\Database\Helpers\Role; use Utopia\Database\Validator\Authorization; +use Utopia\Queue\Broker\Pool as BrokerPool; use Utopia\Queue\Publisher; use Utopia\System\System; use Utopia\Telemetry\Adapter as Telemetry; From 100ab4ef896ce2c02f900f68d9766c23b8fac55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 11 Aug 2025 15:36:11 +0200 Subject: [PATCH 16/16] Fix flakyness --- tests/e2e/Services/Messaging/MessagingBase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/e2e/Services/Messaging/MessagingBase.php b/tests/e2e/Services/Messaging/MessagingBase.php index dc5ddb9d70..728d3f0082 100644 --- a/tests/e2e/Services/Messaging/MessagingBase.php +++ b/tests/e2e/Services/Messaging/MessagingBase.php @@ -3,6 +3,7 @@ namespace Tests\E2E\Services\Messaging; use Appwrite\Messaging\Status as MessageStatus; +use Appwrite\Tests\Retry; use CURLFile; use Tests\E2E\Client; use Utopia\Database\DateTime; @@ -1190,6 +1191,7 @@ trait MessagingBase $this->assertEquals(MessageStatus::FAILED, $message['body']['status']); } + #[Retry(count: 3)] public function testUpdateScheduledAt(): void { // Create user