Skip to content

fix(api): timeout on startup on 7.0 and 6.12#1844

Merged
elibosley merged 2 commits intomainfrom
fix/timeout-on-startup-too-short
Dec 16, 2025
Merged

fix(api): timeout on startup on 7.0 and 6.12#1844
elibosley merged 2 commits intomainfrom
fix/timeout-on-startup-too-short

Conversation

@elibosley
Copy link
Member

@elibosley elibosley commented Dec 16, 2025

Updated the total startup budget, bootstrap reserved time, and maximum operation timeout values to enhance API startup reliability. The total startup budget is now set to 30 seconds, with 20 seconds reserved for bootstrap and a maximum operation timeout of 5 seconds.

Summary by CodeRabbit

  • Chores
    • Extended application startup timeout to 30 seconds and increased operation timeout budgets during initialization, providing additional processing time for startup operations and initialization tasks.

✏️ Tip: You can customize this high-level summary in your review settings.

Updated the total startup budget, bootstrap reserved time, and maximum operation timeout values to enhance API startup reliability. The total startup budget is now set to 30 seconds, with 20 seconds reserved for bootstrap and a maximum operation timeout of 5 seconds.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 16, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This pull request extends application startup and bootstrap timeout constants in both PM2 configuration and the application's index file, allowing the app more time to initialize before triggering timeout errors.

Changes

Cohort / File(s) Summary
Startup timeout adjustments
api/ecosystem.config.json
Updated PM2 ecosystem listen_timeout from 15,000 ms to 30,000 ms, doubling the grace period for the app to report readiness
Bootstrap startup budgets
api/src/index.ts
Increased three timeout constants: TOTAL_STARTUP_BUDGET_MS (13,000 → 30,000 ms), BOOTSTRAP_RESERVED_MS (8,000 → 20,000 ms), and MAX_OPERATION_TIMEOUT_MS (2,000 → 5,000 ms)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Simple, homogeneous timeout value adjustments across two configuration/constant files
  • No logic changes or control flow modifications
  • Straightforward verification: confirm new values are consistent and reasonable

Poem

🐰 A little more time, the app does seek,
Thirty seconds now, before it's meek,
Bootstrap breathes deep, no longer tight,
Five-thousand milliseconds of might!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/timeout-on-startup-too-short

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01a63fd and 6becffc.

📒 Files selected for processing (2)
  • api/ecosystem.config.json (1 hunks)
  • api/src/index.ts (1 hunks)

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 33 to +35
// PM2 listen_timeout is 15 seconds (ecosystem.config.json)
// We use 13 seconds as our total budget to ensure our timeout triggers before PM2 kills us
const TOTAL_STARTUP_BUDGET_MS = 13_000;
const TOTAL_STARTUP_BUDGET_MS = 30_000;

Choose a reason for hiding this comment

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

P1 Badge Keep startup budget under PM2 listen_timeout

The new TOTAL_STARTUP_BUDGET_MS of 30s now exceeds the PM2 listen_timeout of 15s in api/ecosystem.config.json (line 10), so the TimeoutBudget can authorize operations and a bootstrap window that run well past the supervisor’s kill threshold. In environments where startup legitimately takes >15s, PM2 will restart the process before our 30s budget expires, causing repeated startup failures instead of graceful timeouts, contrary to the intent documented in the comment on these lines.

Useful? React with 👍 / 👎.

@codecov
Copy link

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.89%. Comparing base (01a63fd) to head (6becffc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/src/index.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1844   +/-   ##
=======================================
  Coverage   52.89%   52.89%           
=======================================
  Files         868      868           
  Lines       50051    50051           
  Branches     5079     5079           
=======================================
  Hits        26473    26473           
  Misses      23503    23503           
  Partials       75       75           

☔ 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.

Increased the listen timeout from 15 seconds to 30 seconds in the ecosystem configuration to enhance the API's startup reliability.
@github-actions
Copy link
Contributor

This plugin has been deployed to Cloudflare R2 and is available for testing.
Download it at this URL:

https://preview.dl.unraid.net/unraid-api/tag/PR1844/dynamix.unraid.net.plg

@elibosley elibosley changed the title fix(api): increase timeout budgets for improved startup reliability fix(api): timeout on startup on 7.0 and 6.12 Dec 16, 2025
@elibosley elibosley merged commit e243ae8 into main Dec 16, 2025
11 of 13 checks passed
@elibosley elibosley deleted the fix/timeout-on-startup-too-short branch December 16, 2025 16:37
elibosley pushed a commit that referenced this pull request Dec 16, 2025
🤖 I have created a release *beep* *boop*
---


## [4.28.2](v4.28.1...v4.28.2)
(2025-12-16)


### Bug Fixes

* **api:** timeout on startup on 7.0 and 6.12
([#1844](#1844))
([e243ae8](e243ae8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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