Skip to content

Make Discord healthMonitor configurable via channels.discord config #41471

@felipematos

Description

@felipematos

Problem

The Discord channel health monitor settings are currently hardcoded in the source code with these values:

  • checkIntervalMs: How often to check channel health
  • staleEventThresholdMs: How long before a channel is considered stale
  • maxRestartsPerHour: Maximum restart attempts per hour

Impact

  1. No flexibility - Cannot tune these values for different usage patterns
  2. Unnecessary restarts - On quiet channels, the default stale threshold may trigger restarts when the channel is simply inactive (no new messages)
  3. No per-channel customization - All channels use the same hardcoded values regardless of their activity level

Proposed Solution

Add a channels.discord.healthMonitor configuration section that allows users to customize these settings.

Example Config Structure

{
  "channels": {
    "discord": {
      "healthMonitor": {
        "checkIntervalMs": 30000,
        "staleEventThresholdMs": 120000,
        "maxRestartsPerHour": 3
      }
    }
  }
}

Fallback Behavior

  • If config section is not present, use sensible defaults (current hardcoded values or improved defaults)
  • Validate values to prevent misconfiguration (e.g., minimum thresholds)

Investigation Reference

This was identified during debugging of unnecessary Discord channel restarts in production. The hardcoded values did not account for quiet periods where no events are expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions