Skip to content

feat: Add bandwidth & speed scheduler with timetable and metered connection support #90

Description

@ja7ad

Preflight checklist

  • I searched existing issues and this has not been proposed already.
  • I checked the README and this is not already supported.

Component

Core Engine / Desktop GUI / Configuration

Problem

  1. Network Congestion During Active Hours: Hydra's multi-connection engine aggressively consumes available bandwidth, which saturates shared home/office networks during working hours or peak gaming/streaming times.
  2. Manual Intervention Overhead: Users currently have to manually pause downloads or manually tweak global speed limits when starting/stopping work.
  3. Metered Connection Hazards: When switching to mobile hotspots or metered connections, unconstrained background downloads can rapidly deplete limited data quotas.

Proposed solution

Implement a dynamic Bandwidth & Speed Scheduler that programmatically adjusts download rates, connection limits, and active queues based on time windows and network status.

Key Capabilities

  1. Configurable Time-Window Rules (Config / CLI):
  • Support a timetable configuration in config.toml (or daemon configuration) specifying time blocks, days of the week, and respective rate limits:
  • Normal Speed Limit: Default speed ceiling during general usage.
  • Alternative / Off-Peak Speed Limit: Unrestricted or high speeds during off-peak hours (e.g., 12:00 AM – 07:00 AM).
  • Work/Strict Limit: Restrictive cap during business hours (e.g., Mon–Fri, 09:00 AM – 06:00 PM: 2 MB/s).
  1. GUI Weekly Timetable Grid:
  • Provide an interactive 7x24 weekly matrix view in Options > Speed / Scheduler (similar to qBittorrent/Transmission) where users can paint hourly slots with:
  • Full Speed
  • Alternative Speed Limit
  • Paused / Queue Only
  1. Live Rate Limiter Adaptation (Zero Disconnection):
  • The underlying token-bucket rate limiter in the core engine should dynamically update its refill capacity upon schedule transitions without terminating active multi-part TCP streams or resetting chunk buffers.
  1. Metered Network Detection & Guard:
  • Detect OS metered connection states (via NetworkInformation on Windows, NetworkManager metered property on Linux, or SCNetworkReachability flags on macOS) to auto-pause or throttle downloads unless explicitly bypassed.

Alternatives considered

  • Static Global Speed Limit: Requires manual switching twice a day.
  • External OS-Level Traffic Control (tc, NetLimiter, pf): Hard to configure, platform-dependent, and outside Hydra's direct control.

Platforms this should cover

  • Linux
  • macOS
  • Windows
  • Android / iOS (via libhydra)

Additional context

Proposed Configuration Schema (config.toml)

[speed_limit]
global_download_rate = "0" # 0 = unlimited

[scheduler]
enabled = true
alt_download_rate = "2MB/s"
alt_upload_rate = "500KB/s"

# Active alternative speed windows
[[scheduler.rules]]
days = ["Mon", "Tue", "Wed", "Thu", "Fri"]
start_time = "09:00"
end_time = "18:00"
action = "alt_limit" # "alt_limit" | "pause" | "unlimited"

[[scheduler.rules]]
days = ["Everyday"]
start_time = "00:00"
end_time = "07:00"
action = "unlimited"

Compatibility

  • This changes existing behavior (flags, defaults, output format, or the C ABI).

Contribution

  • I'm willing to open a pull request implementing this.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions