Comments (5)
We should probably cancel timers on --hot
reload.
from bun.
For anyone using --hot as of today, you can use a simple looping alternative:
console.log(`Program started`, Date.now())
intervalFunction();
function intervalFunction()
{
console.log("Hello World !");
await new Promise(resolve => setTimeout(resolve, 1000))
return await intervalFunction();
}
from bun.
Update, it appears that the issue occurs on setInterval.
/*
[DEBUG] Loading new schedule : _schedules/paidProductsDisabler with interval of 1000
[DEBUG] Controller Executed at 1708544326475
[2] Billing status: 1 | Days Left: 17.86 | Failed Days Left: null
[4] Billing status: 3 | Days Left: 17.87 | Failed Days Left: null
[DEBUG] Controller Executed at 1708544326479
[2] Billing status: 1 | Days Left: 17.86 | Failed Days Left: null
[4] Billing status: 3 | Days Left: 17.87 | Failed Days Left: null
[DEBUG] Controller Executed at 1708544326482
[2] Billing status: 1 | Days Left: 17.86 | Failed Days Left: null
[4] Billing status: 3 | Days Left: 17.87 | Failed Days Left: null
[DEBUG] Controller Executed at 1708544326485
[2] Billing status: 1 | Days Left: 17.86 | Failed Days Left: null
[4] Billing status: 3 | Days Left: 17.87 | Failed Days Left: null
One is supposed to arrive
*/
console.log(`Entering loading Schedules [Total: ${this.#schedules.length} schedules]`);
for (let schedule of this.#schedules)
{
console.log(`[DEBUG] Loading new schedule : ${schedule.controller} with interval of ${schedule.interval}`);
setTimeout(() => {
let res = new ResponseBuilder(this.#directory, "");
return res.loadController(schedule.controller, {
models: this.#models
}, res)
}, schedule.interval);
}
from bun.
For anyone using --hot as of today, you can use a simple looping alternative:
console.log(`Program started`, Date.now()) intervalFunction(); function intervalFunction() { console.log("Hello World !"); await new Promise(resolve => setTimeout(resolve, 1000)) return await intervalFunction(); }
Thank you,
still there are some native or npm packages using interval e.g. @elysiajs/cron
from bun.
Well, the objective would be to resolve the conflicts linked to Bun --hot and Timers, I do not see how using cron resolves the issue by itself as it is a core Javascript feature that is "compromised"
from bun.
Related Issues (20)
- HTMLRewriter fails to process Responses created from ReadableStreams
- [Bug]: Timeout Error when Launching Chromium with Playwright
- Bun doesn't finish the execution when all workers' ports are closed
- [Crash] Panic on main thread when downloading a file using fetch() on a compiled executable
- Self-referencing enums are mangled
- bun install crash report HOT 1
- Segmentation fault on sharp HOT 8
- `bun ci` as shortcut for `bun i --frozen-lockfile` HOT 1
- Crash in TS experimental decorators due to missing error check
- This can be closed
- Crash HOT 2
- bun not run using astro
- Bun can't handle image file sent from .net 8 in form data
- can bun runtime run pnpm?
- Cannot load DLL for leveldown HOT 1
- Huge date problem, makes tests fails whereas in jest they work properly HOT 2
- `bun run index.ts` ignores module in package.json
- Crash with the bun update --latest
- Duplicate "graphql" modules error running a single-file executable built with `bun build` when using yoga or apollo HOT 2
- Panicked while trying to install dependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bun.