Skip to content

Conversation

d4mr
Copy link
Member

@d4mr d4mr commented Oct 9, 2025

Introduced a new environment variable QUEUE_JOB_RETENTION_AGE_SECONDS to define the age (in seconds) after which completed or failed jobs are eligible for removal. Updated job options to utilize this variable for job retention settings.


PR-Codex overview

This PR focuses on updating job retention configurations in the queues.ts file to use environment variables for job age retention instead of hardcoded values. It also adds a new environment variable for job retention age in env.ts.

Detailed summary

  • In src/worker/queues/queues.ts:

    • Updated removeOnComplete and removeOnFail to use env.QUEUE_JOB_RETENTION_AGE_SECONDS instead of a hardcoded value of 7 days.
  • In src/shared/utils/env.ts:

    • Added a comment explaining QUEUE_JOB_RETENTION_AGE_SECONDS.
    • Introduced QUEUE_JOB_RETENTION_AGE_SECONDS environment variable to the exported env object.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Job history retention is now configurable via an environment variable (QUEUE_JOB_RETENTION_AGE_SECONDS), affecting both completed and failed jobs. Default remains 7 days.
  • Chores

    • Updated queue configuration to source retention duration from environment settings, improving operational flexibility without changing other behavior.

Introduced a new environment variable QUEUE_JOB_RETENTION_AGE_SECONDS to define the age (in seconds) after which completed or failed jobs are eligible for removal. Updated job options to utilize this variable for job retention settings.
@d4mr d4mr merged commit b9a20f8 into main Oct 9, 2025
6 checks passed
@d4mr d4mr deleted the pb/env-job-retention-time branch October 9, 2025 20:02
Copy link

coderabbitai bot commented Oct 9, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Introduced QUEUE_JOB_RETENTION_AGE_SECONDS to the environment schema with a 7-day default (in seconds) and wired it into runtimeEnvStrict. Updated worker queue configuration to source removeOnComplete.age and removeOnFail.age from this environment value instead of a hardcoded 7 days.

Changes

Cohort / File(s) Summary of Changes
Environment configuration
src/shared/utils/env.ts
Added QUEUE_JOB_RETENTION_AGE_SECONDS to server config schema with default of 7 days (in seconds) and propagated it to runtimeEnvStrict via process.env.
Worker queue retention
src/worker/queues/queues.ts
Replaced hardcoded 7-day ages for removeOnComplete and removeOnFail with env.QUEUE_JOB_RETENTION_AGE_SECONDS; counts unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ 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 pb/env-job-retention-time

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f01717a and b1583f1.

📒 Files selected for processing (2)
  • src/shared/utils/env.ts (2 hunks)
  • src/worker/queues/queues.ts (1 hunks)

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

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.

1 participant