diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-02-26 20:03:29 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-02-26 20:21:56 +0100 |
| commit | 3662225a7e42b60f661871e4562239d5cdeabe98 (patch) | |
| tree | 3a809a33992a838dbc2391236b243c7d5df9f862 /src/io/timeout.nim | |
| parent | 55ffd92756faa3b60e3472404025a18509e0fce2 (diff) | |
| download | chawan-3662225a7e42b60f661871e4562239d5cdeabe98.tar.gz | |
dynstream, console: remove DynFileStream
Conflating buffered streams with non-buffered streams is generally a
bad idea.
Diffstat (limited to 'src/io/timeout.nim')
| -rw-r--r-- | src/io/timeout.nim | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/io/timeout.nim b/src/io/timeout.nim index 0015d892..c131b9c6 100644 --- a/src/io/timeout.nim +++ b/src/io/timeout.nim @@ -2,7 +2,6 @@ import std/algorithm import std/times import io/console -import io/dynstream import monoucha/fromjs import monoucha/javascript import monoucha/jsutils @@ -80,12 +79,12 @@ proc setTimeout*(state: var TimeoutState; t: TimeoutType; handler: JSValue; state.sorted = false return id -proc runEntry(state: var TimeoutState; entry: TimeoutEntry; err: DynStream) = +proc runEntry(state: var TimeoutState; entry: TimeoutEntry; console: Console) = if JS_IsFunction(state.jsctx, entry.val): let ret = JS_Call(state.jsctx, entry.val, JS_UNDEFINED, cint(entry.args.len), entry.args.toJSValueArray()) if JS_IsException(ret): - state.jsctx.writeException(err) + console.writeException(state.jsctx) JS_FreeValue(state.jsctx, ret) else: var s: string @@ -103,7 +102,7 @@ proc sortAndGetTimeout*(state: var TimeoutState): cint = let now = getUnixMillis() return cint(max(state.timeouts[^1].expires - now, -1)) -proc run*(state: var TimeoutState; err: DynStream): bool = +proc run*(state: var TimeoutState; console: Console): bool = let now = getUnixMillis() var found = false var H = state.timeouts.high @@ -113,7 +112,7 @@ proc run*(state: var TimeoutState; err: DynStream): bool = let entry = state.timeouts[i] if entry.dead: continue - state.runEntry(entry, err) + state.runEntry(entry, console) found = true case entry.t of ttTimeout: |