Skip to content

fix(backend): クラスタ有効時にonlyQueueモードでジョブキューが二重起動する問題を修正#17295

Closed
kakkokari-gtyih wants to merge 2 commits intomisskey-dev:developfrom
kakkokari-gtyih:fix-17292-1
Closed

fix(backend): クラスタ有効時にonlyQueueモードでジョブキューが二重起動する問題を修正#17295
kakkokari-gtyih wants to merge 2 commits intomisskey-dev:developfrom
kakkokari-gtyih:fix-17292-1

Conversation

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

What

Why

#17292 がなおるかもしれない

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.67%. Comparing base (92e0e8e) to head (6d67edf).
⚠️ Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
packages/backend/src/boot/master.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #17295      +/-   ##
===========================================
- Coverage    63.79%   63.67%   -0.13%     
===========================================
  Files         1162     1162              
  Lines       116401   116402       +1     
  Branches      8455     8414      -41     
===========================================
- Hits         74261    74115     -146     
- Misses       39941    40088     +147     
  Partials      2199     2199              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

このPRによるapi.jsonの差分
差分はありません。
Get diff files from Workflow Page

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Backend memory usage comparison

Before GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 316.71 MB 321.17 MB +4.45 MB +1.40%
VmHWM 316.71 MB 321.17 MB +4.45 MB +1.40%
VmSize 23110.76 MB 23114.93 MB +4.16 MB +0.01%
VmData 1381.12 MB 1386.45 MB +5.32 MB +0.38%

After GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 316.76 MB 321.18 MB +4.42 MB +1.39%
VmHWM 316.76 MB 321.18 MB +4.42 MB +1.39%
VmSize 23110.76 MB 23115.27 MB +4.50 MB +0.01%
VmData 1381.12 MB 1386.79 MB +5.66 MB +0.40%

After Request

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 317.13 MB 321.85 MB +4.71 MB +1.48%
VmHWM 317.13 MB 321.85 MB +4.71 MB +1.48%
VmSize 23110.76 MB 23115.68 MB +4.91 MB +0.02%
VmData 1381.12 MB 1387.20 MB +6.07 MB +0.44%

See workflow logs for details

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

クラスタ有効時(disableClustering が false)に onlyQueue モードで起動するとジョブキューが親プロセス・子プロセスの両方で起動してしまう問題を防ぎ、キュー処理の二重起動を解消するPRです。

Changes:

  • クラスタ有効時の onlyQueue モードで、マスタープロセス側の jobQueue() 起動を抑止
  • CHANGELOG に修正内容を追記

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/backend/src/boot/master.ts クラスタ有効時の onlyQueue 分岐でマスターが jobQueue() を起動しないように変更
CHANGELOG.md 上記修正の告知を追記

Comment on lines 100 to 103
} else if (envOption.onlyQueue) {
await jobQueue();
// onlyQueue かつ enableCluster な場合も、メインプロセスはforkのみに制限する。
// ワーカープロセス側でjobQueueを起動するため、ここで起動すると親子でキュー処理が二重起動する。
} else {
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

With clustering enabled and onlyQueue mode, the master no longer starts jobQueue() (intended), so the queue will only start in forked workers. However, if config.clusterLimit is explicitly set to 0, spawnWorkers(0) will spawn zero workers and the queue will never start (previously the master started it even when worker count was 0). Consider enforcing clusterLimit >= 1 (or falling back to 1) in this branch, or explicitly erroring on clusterLimit <= 0 when clustering is enabled.

Copilot uses AI. Check for mistakes.
@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

たぶんこれではなおらない

@github-project-automation github-project-automation bot moved this from Todo to Done in [実験中] 管理用 Apr 11, 2026
@kakkokari-gtyih kakkokari-gtyih deleted the fix-17292-1 branch April 11, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/backend Server side specific issue/PR

Projects

Development

Successfully merging this pull request may close these issues.

2 participants