Tags: yeqiaojun/kcp-go
Tags
Replace heap scheduler with fixed-tick shards Rewrite TimedSched internals from a heap+timer design to a sharded fixed-tick scheduler: add timedSchedResolution, per-shard incoming queues, wake channels, and a runShard loop that scans tasks on a ticker and executes due work immediately. Preserve public API (NewTimedSched, Put, Close) but clamp parallelism to >=1 and add defaultTimedSchedParallel() based on GOMAXPROCS. Update Put to route tasks to shards and wake shards for already-due tasks; remove the prepend goroutine, per-worker heaps, and per-task timer reset logic. Also add scheduler regression tests and benchmarks (including TestTimedSchedZeroParallelStillRunsTasks and BenchmarkTimedSched5000Recurring/Burst) and a design plan doc under docs/plans. Fixes zero-parallel bug and improves scheduling scalability and determinism.
Replace heap scheduler with fixed-tick shards Rewrite TimedSched internals from a heap+timer design to a sharded fixed-tick scheduler: add timedSchedResolution, per-shard incoming queues, wake channels, and a runShard loop that scans tasks on a ticker and executes due work immediately. Preserve public API (NewTimedSched, Put, Close) but clamp parallelism to >=1 and add defaultTimedSchedParallel() based on GOMAXPROCS. Update Put to route tasks to shards and wake shards for already-due tasks; remove the prepend goroutine, per-worker heaps, and per-task timer reset logic. Also add scheduler regression tests and benchmarks (including TestTimedSchedZeroParallelStillRunsTasks and BenchmarkTimedSched5000Recurring/Burst) and a design plan doc under docs/plans. Fixes zero-parallel bug and improves scheduling scalability and determinism.