Skip to content

Adaptive auto-reload intervals + config-driven auto-reload and column visibility #46

@yimsk

Description

@yimsk

Summary

Auto-reload interval is currently fixed at 3s (DefaultAutoReloadInterval). This is aggressive for slow networks or heavy API calls. Additionally, there's no way to configure which resources auto-reload or customize visible columns.

Current Behavior

  • DefaultAutoReloadInterval = 3 * time.Second (internal/view/view.go:17)
  • defaultLogPollInterval = 3 * time.Second (internal/view/log_view.go:21) - LogView polling
  • Auto-reload only applies to navigations with AutoReload: true (currently only CFN stacks events)
  • LogView always polls at fixed 3s interval
  • Fixed interval regardless of actual API response time
  • No user configuration for auto-reload targets or table columns

Proposed Changes

Phase 1: Adaptive Interval (Option B - rest-after-completion)

  • Track reload duration per view
  • Next tick delay = clamp(min, max, baseDuration + lastDuration * factor)
    • Example: min=5s, max=60s, factor=1.5
  • Error backoff: exponential (5s → 10s → 20s → ... up to 5min), reset on success
  • Add jitter (±10%) to avoid synchronized bursts
  • Update status line to show current interval: (auto-refresh: 15s) or (auto-refresh: 30s, backoff)
  • Apply to LogView polling as well

Phase 2: Config file support

# ~/.config/claws/config.yaml (example)
auto_reload:
  default_interval: 10s
  min_interval: 5s
  max_interval: 60s
  enabled:
    - cfn/events
    - ecs/tasks
    - cloudwatch/log-view  # LogView streaming
    # - ec2/instances  # commented = disabled

columns:
  ec2/instances:
    - NAME
    - ID
    - STATE
    - TYPE
    - PRIVATE IP
    # - AZ  # hidden
    # - AGE  # hidden

Acceptance Criteria

  • No concurrent overlapping reload commands
  • Interval adapts to actual API response time
  • Error backoff prevents hammering on failures
  • Status line shows current auto-refresh interval
  • LogView uses adaptive polling interval
  • (Phase 2) Config file controls auto-reload targets
  • (Phase 2) Config file controls visible columns per resource type

References

  • Snap doc: fe6498a7-5445-7712-9660-fedb54aa3d66 (Adaptive Auto-Reload design)
  • Snap doc: fe6498b2-dfb3-79bc-bea5-68b2307e7422 (inline metrics review decisions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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