duktape icon indicating copy to clipboard operation
duktape copied to clipboard

Improve executor timeout mechanism

Open svaarala opened this issue 9 years ago • 3 comments

  • [ ] Rate limit the callbacks based on Date-provided timestamp check (avoid checking too often as it may be expensive to get current time)
  • [ ] Add timeout propagation state explicitly into Duktape state (instead of relying on the callback consistently indicating timeout until the RangeError has fully bubbled out)
  • [ ] Rework into an actual API call because this is a generally useful feature (unlike e.g. low memory options)

svaarala avatar Apr 03 '15 17:04 svaarala

+1 for improvements regarding suspend/resume discussed in #90

I'm also looking for context-switching. e.g. running multiple contexts with some kind of scheduler. With suspend/resume (or run_this_context(context, opsToRunBeforeBreak)) would make it possible to write long-running code ("while(true)" for example) without blocking other contexts for too long.

jfd avatar Apr 23 '15 09:04 jfd

A related feature that could be supported by the API is a sort of watchdog timer.

I'm currently working with an event loop, something like the following:

while(SendHeartBeat()) {
  // do work that *should* take a short amount of time
}

SendHeartBeat is written in C. So long as it is called regularly, we know that the work is taking a short amount of time. If it isn't called, the code has hung for some reason and we want to abort it.

dhiltonp avatar Sep 22 '16 05:09 dhiltonp

FWIW, this issue was mentioned over on the polkit issue tracker.

Looks like polkit is considering switching to duktape over mozjs, as the latter greatly complicates the build process with all of the compile-time dependencies mozjs pulls in.

Might want to coordinate with the polkit devs.

cstrahan avatar Apr 11 '21 02:04 cstrahan