Repository navigation
fix(functions): set TTL when saving jobs dedupe markers in Redis - #15839
Open
saiyyedfardeen wants to merge 1 commit into
Open
saiyyedfardeen wants to merge 1 commit into
saiyyedfardeen wants to merge 1 commit into
Conversation
Code review
The Functions jobs worker now saves build callback deduplication markers with the same one-hour TTL used when checking them. An end-to-end test deploys a function and inspects the resulting Redis marker TTLs. Note @saiyyedfardeen does not have write access to this repository, so Hansi does not approve automatically. A maintainer can review and approve. Walkthrough (2)
Fixed since the last review (2)
Filtered out (1)Findings Hansi considered but did not post.
Reviewed Tip Comment |
2 tasks done
…write#15746) Signed-off-by: Fardeen Saiyyed <[email protected]>
saiyyedfardeen
force-pushed
the
fix-15746-jobs-dedupe-ttl
branch
from
November 19, 2026 18:42
3f4d50b to
b675cd6
Compare
2 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Fixes #15746.
In
src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php, build/execution callback deduplication markers (jobs-event-{projectSequence}-{eventId}) are checked using$cache->load($key, self::DEDUPE_TTL)(3600seconds), but were saved via$cache->save($key, true)without passing a TTL.Because
Utopia\Cache\Cache::save()defaults to$ttl = 0, the Redis adapter never set anEXPIREon these keys, causingjobs-event-*hashes to accumulate indefinitely in Redis withTTL = -1and compete with document caches and queues underallkeys-lru.Changes
src/Appwrite/Platform/Modules/Functions/Workers/Jobs.php: Passedttl: self::DEDUPE_TTL(3600seconds) to$cache->save()for both non-log build callbacks (artifact, exit, complete) and log callbacks (onLog).tests/unit/Platform/Modules/Functions/Workers/JobsDedupeTest.php: Added unit tests verifying that:jobs-event-*markers withttl: 3600.DEDUPE_TTLwindow are skipped without redundant database reads/writes or realtime broadcasts.Test Plan
php -lsyntax checks on all modified/created files.vendor/bin/pint(PSR-12 compliant).vendor/bin/phpstanstatic analysis (0 errors).vendor/bin/phpunit tests/unit/Platform/Modules/Functions/Workers/JobsDedupeTest.php— 5 tests, 36 assertions passing; fullWorkers/suite — 11 tests, 49 assertions passing).Related PRs and Issues
jobs-event-*) in Redis without TTL #15746Checklist