Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

This PR makes the DutiesChecker service's poll interval configurable through the DUTIES_CHECKER_POLL_INTERVAL_SECONDS environment variable, replacing the previously hardcoded 1-minute interval.

Changes Made

  • Config Structure: Added PollIntervalSeconds field to the Config struct in internal/config/config_loader.go
  • Environment Variable Support: The service now reads DUTIES_CHECKER_POLL_INTERVAL_SECONDS during configuration loading
  • Default Behavior: Defaults to 60 seconds when the environment variable is not set, maintaining similar behavior to the previous 1-minute hardcoded value
  • Input Validation: Added robust validation that ensures only positive integer values are accepted, with fallback to the default for invalid inputs
  • Integration: Updated cmd/main.go to use the configuration value instead of the hardcoded 1 * time.Minute

Usage

# Use default 60-second interval
./validator-tracker

# Set custom interval (e.g., 30 seconds)
DUTIES_CHECKER_POLL_INTERVAL_SECONDS=30 ./validator-tracker

# Invalid values fall back to default with warning
DUTIES_CHECKER_POLL_INTERVAL_SECONDS=invalid ./validator-tracker

Error Handling

The implementation includes comprehensive error handling:

  • Non-numeric values trigger a warning and use the default
  • Zero or negative values are rejected and use the default
  • The configuration logging shows the actual poll interval being used

This change allows operators to tune the polling frequency based on their specific requirements without requiring code changes or rebuilds.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • beacon-chain.hoodi.dncore.dappnode
    • Triggering command: /tmp/go-build4097434652/b001/exe/main (dns block)
    • Triggering command: /home/REDACTED/.cache/go-build/01/01f2aaded82f00bec7b66fc81586d51f4d845787dc59cf61fe2bf7624311008b-d/main (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Update the DutiesChecker service so its PollInterval is set by a DUTIES_CHECKER_POLL_INTERVAL_SECONDS environment variable, defaulting to 60 seconds if unset. The variable should be read along with the others in config_loader.go. The Config struct should include a PollIntervalSeconds field, and main.go should pass this interval to DutiesChecker (converted to time.Duration).

This pull request was created as a result of the following prompt from Copilot chat.

Update the DutiesChecker service so its PollInterval is set by a DUTIES_CHECKER_POLL_INTERVAL_SECONDS environment variable, defaulting to 60 seconds if unset. The variable should be read along with the others in config_loader.go. The Config struct should include a PollIntervalSeconds field, and main.go should pass this interval to DutiesChecker (converted to time.Duration).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…riable

Co-authored-by: Marketen <36164126+Marketen@users.noreply.github.com>
Copilot AI changed the title [WIP] Update DutiesChecker to read PollInterval from environment variable Make DutiesChecker poll interval configurable via environment variable Oct 14, 2025
Copilot AI requested a review from Marketen October 14, 2025 09:15
@Marketen Marketen marked this pull request as ready for review October 14, 2025 09:22
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.

3 participants