Skip to content

fix: add ShutdownTimeout to SatelliteOptions struct - #605

Open
Dishank-Sen wants to merge 1 commit into
container-registry:mainfrom
Dishank-Sen:refactor/fix-migration-inconsistency
Open

fix: add ShutdownTimeout to SatelliteOptions struct#605
Dishank-Sen wants to merge 1 commit into
container-registry:mainfrom
Dishank-Sen:refactor/fix-migration-inconsistency

Conversation

@Dishank-Sen

@Dishank-Sen Dishank-Sen commented Aug 9, 2026

Copy link
Copy Markdown

Description

Moves shutdownTimeout into the SatelliteOptions struct for consistency with all other CLI flags and environment variables.

Changes:

  • Added ShutdownTimeout field to SatelliteOptions struct (line 61)
  • Initialized from envCfg.ShutdownTimeout in main() (line 87)
  • Updated flag binding to use opts.ShutdownTimeout (line 104)
  • Removed separate shutdownTimeout variable
  • Simplified run() function signature from 3 to 2 parameters (line 253, 163)
  • Passed opts.ShutdownTimeout to gracefulShutdown() (line 435)

Impact:
This is a pure refactoring with no functional changes. All 16 configuration values now follow the same pattern, making the codebase more consistent and maintainable.

Testing:

  • Code compiles successfully
  • All unit tests pass
  • CLI flag --shutdown-timeout works correctly with default value of 30s

Additional context

This inconsistency was introduced during the env package refactor (commit a3a6145, PR #514) where ShutdownTimeout was added to env.HarborSatellite but not migrated to SatelliteOptions like other fields.

The change actually reduces complexity by removing a parameter from run() while maintaining identical behavior.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a configurable shutdown timeout for graceful application shutdown.
    • The timeout can be set through environment configuration or the --shutdown-timeout command-line option.
  • Improvements

    • Shutdown behavior now consistently uses the configured timeout value.

@github-actions github-actions Bot added the golang label Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 90616bed-a26d-461d-b62e-f37b19a85cdd

📥 Commits

Reviewing files that changed from the base of the PR and between 341cb42 and c91acd8.

📒 Files selected for processing (1)
  • cmd/satellite/main.go

📝 Walkthrough

Walkthrough

The satellite now stores shutdown timeout in SatelliteOptions. Environment configuration and the CLI flag populate this field. run uses the options value for graceful shutdown.

Changes

Satellite shutdown timeout refactor

Layer / File(s) Summary
Shutdown timeout option configuration
cmd/satellite/main.go
Adds SatelliteOptions.ShutdownTimeout, initializes it from environment configuration, and binds --shutdown-timeout directly to the option.
Run and graceful shutdown propagation
cmd/satellite/main.go
Removes the standalone run timeout parameter and passes opts.ShutdownTimeout to graceful shutdown.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: vg006

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding ShutdownTimeout to SatelliteOptions.
Description check ✅ Passed The description includes the issue reference, change summary, impact, testing details, and additional context.
Linked Issues check ✅ Passed The changes satisfy issue #604 by moving ShutdownTimeout into SatelliteOptions and simplifying run() to two parameters.
Out of Scope Changes check ✅ Passed The changes are limited to the requested shutdown-timeout refactoring and related parameter updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@gitar-bot

gitar-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

Gitar is working

Gitar

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 medium

Alerts:
⚠ 2 issues (≤ 0 issues of at least minor severity)

Results:
2 new issues

Category Results
Complexity 2 medium

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

Signed-off-by: Dishank-Sen <dishanksen05@gmail.com>
@Dishank-Sen
Dishank-Sen force-pushed the refactor/fix-migration-inconsistency branch from c91acd8 to adf7ce7 Compare August 9, 2026 18:31
@Dishank-Sen

Copy link
Copy Markdown
Author

@vg006 There is some issue with Codacy, can you help me out.

@vg006

vg006 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Not a big issue, it usually complaints on code standards like line of codes, cyclomatic complexity.

But I reviewed your PR and LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(satellite): move shutdownTimeout to SatelliteOptions for consistency

2 participants