Skip to content

(paas) place imports and reindex worker queues in dedicated containers#643

Merged
zeylos merged 1 commit into
mainfrom
procfile/separate_queues
Apr 29, 2026
Merged

(paas) place imports and reindex worker queues in dedicated containers#643
zeylos merged 1 commit into
mainfrom
procfile/separate_queues

Conversation

@zeylos
Copy link
Copy Markdown
Contributor

@zeylos zeylos commented Apr 24, 2026

Purpose

Description...

Proposal

Description...

  • [] item 1...
  • [] item 2...

Summary by CodeRabbit

  • Chores
    • Optimized background job processing by splitting work across multiple Procfile-managed worker processes with adjusted concurrency and queue separation for better throughput and resource use.
    • Ensured post-deploy migration step is retained.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

Procfile updated to split the single worker process into four processes: worker_all, worker_imports (concurrency=1, scheduler disabled), worker_reindex (concurrency=2, scheduler disabled), and worker_rest (concurrency=4, excludes imports and reindex). postdeploy migration command retained.

Changes

Cohort / File(s) Summary
Process Configuration
Procfile
Replaced single worker entry with four Procfile-managed workers: worker_all: python worker.py; worker_imports: python worker.py --concurrency=1 --queues=imports --disable-scheduler; worker_reindex: python worker.py --concurrency=2 --queues=reindex --disable-scheduler; worker_rest: python worker.py --concurrency=4 --exclude=imports,reindex. postdeploy: python manage.py migrate present. Ensured file ends with newline.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: splitting worker processes to place imports and reindex queues in dedicated containers for better resource management.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zeylos zeylos requested a review from sylvinus April 24, 2026 13:44
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Procfile`:
- Around line 2-3: Procfile currently starts two Celery schedulers because both
Procfile entries "worker" and "workerhuge" omit the scheduler-disable flag;
update the Procfile so only one process runs the scheduler by adding the
--disable-scheduler flag to all worker entries except the one you want to run
beat (e.g., add --disable-scheduler to "workerhuge"), or alternatively create a
dedicated "beat" process and leave other entries "worker" and "workerhuge" with
--disable-scheduler; reference the --disable-scheduler flag and the Procfile
entries "worker" and "workerhuge" when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 775ecaa9-5e9c-45a7-9942-31d71a86ba7f

📥 Commits

Reviewing files that changed from the base of the PR and between 7a0f6fb and 2c22daf.

📒 Files selected for processing (1)
  • Procfile

Comment thread Procfile Outdated
@zeylos zeylos force-pushed the procfile/separate_queues branch from 2c22daf to 12bb31a Compare April 24, 2026 13:53
@zeylos zeylos force-pushed the procfile/separate_queues branch from 12bb31a to dff40d3 Compare April 27, 2026 16:34
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
Procfile (1)

2-5: ⚠️ Potential issue | 🔴 Critical

Critical: multiple Celery beat schedulers will run, causing duplicate periodic tasks.

Per src/backend/worker.py lines 143-145, worker.py adds --beat unless --disable-scheduler is passed. Both worker_all (Line 2) and worker_rest (Line 5) omit that flag, so each will start its own beat scheduler and every periodic/scheduled task will be enqueued at least twice (duplicate emails, reindex jobs, etc.). Only one process should run beat.

🛠️ Suggested fix — pick a single beat owner
-worker_all: python worker.py
-worker_imports: python worker.py --concurrency=1 --queues=imports --disable-scheduler
-worker_reindex: python worker.py --concurrency=2 --queues=reindex --disable-scheduler
-worker_rest: python worker.py --concurrency=4 --exclude=imports,reindex
+worker_all: python worker.py --disable-scheduler
+worker_imports: python worker.py --concurrency=1 --queues=imports --disable-scheduler
+worker_reindex: python worker.py --concurrency=2 --queues=reindex --disable-scheduler
+worker_rest: python worker.py --concurrency=4 --exclude=imports,reindex

Or, preferably, run beat as its own dedicated process and disable the scheduler on every worker.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Procfile` around lines 2 - 5, Procfile currently starts multiple Celery beat
schedulers because worker_all and worker_rest omit the --disable-scheduler flag;
update Procfile so only one process runs beat: either (A) add
--disable-scheduler to worker_all and worker_rest and create a single dedicated
beat entry (e.g., "beat") that runs worker.py without --disable-scheduler, or
(B) choose one existing entry to be the sole beat owner and add
--disable-scheduler to all other entries; key symbols to modify are the Procfile
entries worker_all and worker_rest and the worker.py behavior that injects
--beat unless --disable-scheduler is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Procfile`:
- Around line 2-5: Procfile currently defines worker_all which overlaps with
worker_imports and worker_reindex and breaks the intended concurrency isolation;
pick one of the two fixes and implement it: either remove the worker_all entry
entirely so only the dedicated process types (worker_imports, worker_reindex,
worker_rest) run, or change worker_all to exclude those dedicated queues by
adding the same exclusions as worker_rest (i.e., add --exclude=imports,reindex)
so it no longer pulls from imports/reindex; update the Procfile process line for
worker_all (or delete that line) and ensure the change aligns with the
documented deployment topology.

---

Duplicate comments:
In `@Procfile`:
- Around line 2-5: Procfile currently starts multiple Celery beat schedulers
because worker_all and worker_rest omit the --disable-scheduler flag; update
Procfile so only one process runs beat: either (A) add --disable-scheduler to
worker_all and worker_rest and create a single dedicated beat entry (e.g.,
"beat") that runs worker.py without --disable-scheduler, or (B) choose one
existing entry to be the sole beat owner and add --disable-scheduler to all
other entries; key symbols to modify are the Procfile entries worker_all and
worker_rest and the worker.py behavior that injects --beat unless
--disable-scheduler is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3063b080-da21-413f-85d0-bfcd52ac434b

📥 Commits

Reviewing files that changed from the base of the PR and between 2c22daf and dff40d3.

📒 Files selected for processing (1)
  • Procfile

Comment thread Procfile
@zeylos zeylos merged commit b98b450 into main Apr 29, 2026
13 checks passed
@zeylos zeylos deleted the procfile/separate_queues branch April 29, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants