# bunqueue v2.4.7

Ships 2 performance improvements and 1 addition. Event-driven cron scheduler - Replaced 1s setInterval polling with precise setTimeout that wakes exactly when the next cron is due.

Canonical: https://bunqueue.dev/blog/bunqueue-v2-4-7/

---

<!-- Generated from changelog.md by docs/scripts/generate-release-posts.ts. Edit the changelog and regenerate. -->

Ships 2 performance improvements and 1 addition. Event-driven cron scheduler - Replaced 1s setInterval polling with precise setTimeout that wakes exactly when the next cron is due.

![](https://github.com/egeominotti.png?size=64) [egeominotti](https://github.com/egeominotti)

## What's new

- `scripts/embedded/test-cron-event-driven.ts` - Operational test verifying cron timer precision

## Performance

- **Event-driven cron scheduler** - Replaced 1s `setInterval` polling with precise `setTimeout` that wakes exactly when the next cron is due. Zero wasted ticks between executions:

  | Scenario           | Before                      | After                |
  | ------------------ | --------------------------- | -------------------- |
  | 1 cron every 5min  | 300 ticks/5min (299 wasted) | 1 tick/5min          |
  | 0 crons registered | 1 tick/sec (all wasted)     | 0 ticks              |
  | Cron in 3 hours    | 10,800 wasted ticks         | 1 tick at exact time |

- A 60s `setInterval` safety fallback catches edge cases (timer drift, missed events). Zero functional changes, zero API changes.

## Thanks to 1 contributor!

- [@egeominotti](https://github.com/egeominotti)

---

[← bunqueue v2.4.6](https://bunqueue.dev/blog/bunqueue-v2-4-6/) · [Release on GitHub](https://github.com/egeominotti/bunqueue/releases/tag/v2.4.7) · [Commits since v2.4.6](https://github.com/egeominotti/bunqueue/compare/v2.4.6...v2.4.7) · [Full changelog](https://bunqueue.dev/changelog/) · [All posts](https://bunqueue.dev/blog/)
