Releases: simplegear/rate-envelope-queue
Releases · simplegear/rate-envelope-queue
v1.2.0 - Actual stop mechanism and logs
Merge pull request #46 from simplegear/v1 V1
v1.2.0-rc.4 - Added Drain() and fixed Terminate()
Merge pull request #48 from simplegear/pre-release-v1 Pre release v1
v1.2.0-rc.2
Merge pull request #43 from simplegear/pre-release-v1 Pre release v1
v1.1.1 - Moving to github.com/simplegear/rate-envelope-queue/releases/new
Merge pull request #41 from simplegear/v1 V1
v1.1.0 - Stability and internal features
Release Notes [v1.1.0]
Added
- Terminate() — method to gracefully finalize the last node in the queue state.
- CurrentState() — method to retrieve the current state of the internal state machine.
- Additional integration tests for examples and runtime validation.
Changed
- Improved test coverage to enhance overall stability.
Fixed
- Minor internal adjustments in the queue state logic to improve predictability.
v1.0.0 - rate-envelope-queue
rate-envelope-queue v1.0.0
✨ Highlights
- Safe lifecycle: Start() / Stop() / Start() again without tearing down your app.
- Worker pool: Fixed number of goroutines (WithLimitOption(n)).
- One-shot & periodic tasks: interval == 0 (once) or interval > 0 (rescheduled with AddAfter).
- Deadlines: Per-task timeout via context.WithTimeout; deadline == 0 = no deadline.
- Hooks: beforeHook, afterHook, failureHook, successHook with bounded execution time.
- Stamps (middleware): Chainable wrappers around your invoke (both queue-wide and per-task).
- Capacity control: Optional in-memory quota (WithAllowedCapacityOption(cap)), including unlimited when cap == 0.
- Graceful vs fast stop: Drain (read out everything) and Stop (fast shutdown) modes, plus a waiting switch to join workers.
- Panic safety: Panics inside tasks are caught; item is Forget + Done; worker keeps running.
- Observability: Prometheus workqueue_* metrics via blank-import of the k8s registry.
📈 Benchmarks (as reported by the author; HW/OS affect numbers)
- Dynamic tasks: ~328–349 ns/op, ~37–40 B/op, 1 alloc/op
- Scheduled tasks: ~12.9 µs/op, ~1809 B/op, 24 alloc/op
BenchmarkQueueFull: 3.2M 348.7 ns/op 40 B/op 1 alloc/op
BenchmarkQueueInterval: 110K 12.9 µs/op 1809 B/op 24 alloc/op
🧠 Semantics (short)
- Deduplication: by pointer identity of the enqueued item (inherited from workqueue).
- “Alive” check for rescheduling periodic tasks: queue is running + base ctx alive + not shutting down.
- Special error: ErrStopEnvelope → item is forgotten and not rescheduled.
If it was returned by beforeHook/invoke, the afterHook is still called (with bounded time).
successHook is not called on ErrStopEnvelope. - Timeouts: context.Canceled / DeadlineExceeded are treated as non-success; periodic tasks are rescheduled, one-shot tasks are not.
- Errors:
- Periodic → reschedule if queue is alive.
- One-shot → routed to failureHook → RetryNow / RetryAfter(d) / Drop.
- Hook time limits: per-hook budget = min(hardHookLimit, frac * deadline) (never outlives the task deadline).
v0.0.4 - Rebuilding of package
Rebuilding of package
v0.0.3 - Incapsulation for envelope
With option functions for envelope constructor.
v0.0.2 - Envelopes and stamps
Envelops and stamps
v0.0.1 - Dynamic and static semaphores
Simple simultaneous fast queue with high speed. Dynamic and static semaphores. Serialized keys for the envelope. A simple and accurate lifecycle.