Repository navigation
fix(queue): allow queues on a separate Redis via _APP_REDIS_QUEUE_* - #14112
HarshMN2345 wants to merge 4 commits into
Conversation
🔵 Tier A · Mergeable after minor fixes
Adds optional Redis connection settings for a dedicated queue instance, routing both publishers and worker consumers to it when configured. Documents the settings and the recommended noeviction policy, and forwards them through the Compose services while retaining the shared-Redis fallback.
Fix with agent prompt### Issue 1
app/init/registers.php:61-67
**Add regression coverage for dedicated queue Redis routing**
The new publisher/consumer routing has no automated coverage, despite existing queue integration tests in `tests/e2e/General/WorkerConcurrencyTest.php`. Please add an integration case proving a published job is consumed on the dedicated instance while cache/lock traffic stays on the main instance, plus the unset-host fallback; the reported manual script and Docker unit tests won't catch a future wiring regression.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.📂 Walkthrough · 4
Reviewed |
| $fallbackForQueue = empty(System::getEnv('_APP_REDIS_QUEUE_HOST', '')) ? $fallbackForRedis : 'redis_main=' . AppwriteURL::unparse([ | ||
| 'scheme' => 'redis', | ||
| 'host' => System::getEnv('_APP_REDIS_QUEUE_HOST', ''), | ||
| 'port' => System::getEnv('_APP_REDIS_QUEUE_PORT', '6379'), | ||
| 'user' => \rawurlencode(System::getEnv('_APP_REDIS_QUEUE_USER', '')), | ||
| 'pass' => \rawurlencode(System::getEnv('_APP_REDIS_QUEUE_PASS', '')), | ||
| ]); |
There was a problem hiding this comment.
Add regression coverage for dedicated queue Redis routing
The new publisher/consumer routing has no automated coverage, despite existing queue integration tests in tests/e2e/General/WorkerConcurrencyTest.php. Please add an integration case proving a published job is consumed on the dedicated instance while cache/lock traffic stays on the main instance, plus the unset-host fallback; the reported manual script and Docker unit tests won't catch a future wiring regression.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/init/registers.php
Line: 61-67
Comment:
**Add regression coverage for dedicated queue Redis routing**
The new publisher/consumer routing has no automated coverage, despite existing queue integration tests in `tests/e2e/General/WorkerConcurrencyTest.php`. Please add an integration case proving a published job is consumed on the dedicated instance while cache/lock traffic stays on the main instance, plus the unset-host fallback; the reported manual script and Docker unit tests won't catch a future wiring regression.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.🟡 Minor · testing · Reply if this doesn't apply.
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
2.4.0 was released without these variables, so they cannot have been introduced in 2.3.1.
Security rulesNo new WARNING or ERROR findings from security rules. 19 existing findings tracked in
|
commit: |
Cache, pub/sub, locks, abuse and every queue share one Redis, and the default compose runs it with
allkeys-lru. A backlog inv1-stats-usagepushes the cache out, and it can also evict queue lists, which loses every job in them.This adds optional
_APP_REDIS_QUEUE_HOST/PORT/USER/PASS. When_APP_REDIS_QUEUE_HOSTis set, thepublisherpool (API, realtime, scheduler, health) and the worker consumer inapp/worker.phpconnect to that instance. Cache, pub/sub, lock and abuse stay on_APP_REDIS_*. When it is unset, nothing changes. The variables are documented inapp/config/variables.phpand passed through indocker-compose.yml. The default topology stays the same.The queue instance should run with
maxmemory-policy noeviction. Then a full queue Redis rejects new jobs instead of silently dropping old ones. Don't usenoevictionon the shared instance, because cache writes would start failing.Fixes #14084
Verification
allkeys-lruRedis, pushing 12,000 jobs of 2.1 KB evicted 4,983 keys. Only 19 of 5,000 cache keys survived. The idlev1-mailslist was evicted, and only 3,000 of the 12,000v1-stats-usagejobs remained. Withnoeviction, nothing was evicted and the push failed with OOM.$pools->get('publisher')and builds the consumer fromapp/worker.php. On main, setting_APP_REDIS_QUEUE_HOSThad no effect. With this change, the job and the consumer go to the queue instance, and the lock pool stays on the main one. Password auth was also checked. With the variable unset, behaviour is the same as before.tests/unit/Dockerpasses.