Skip to content

Commit 5839747

Browse files
authored
remove chronos dependency (#38)
* remove chronos dependency The `chronos` backend currently does not work as it relies on nesting `waitFor` calls, which is not supported by chronos itself - as such, this PR disables the backend in testing and prints a recommendation to users to avoid it until the problem has been resolved. faststreams used without `async` continues to work as normal, which also is the most common way to use it - the dependency on chronos in the nimble file is unattractive from a user perspective since it also leads to the the downloading of bearssl and other deps. Hopefully, by the time the chronos backend can be used, we can also specify conditional dependencies in nimble files. * run chronos tests in CI
1 parent 3576a15 commit 5839747

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ jobs:
156156
nim --version
157157
nimble --version
158158
nimble install -y --depsOnly
159-
rm -f nimble.lock
159+
160160
env NIMLANG=c nimble test
161161
env NIMLANG=cpp nimble test
162+
163+
nimble install chronos
164+
env NIMLANG=c nimble testChronos || true
165+
env NIMLANG=cpp nimble testChronos || true

faststreams.nimble

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ skipDirs = @["tests"]
99

1010
requires "nim >= 1.2.0",
1111
"stew",
12-
"chronos",
1312
"unittest2"
1413

1514
let nimc = getEnv("NIMC", "nim") # Which nim compiler to use
@@ -31,8 +30,15 @@ proc run(args, path: string) =
3130

3231
task test, "Run all tests":
3332
# TODO asyncdispatch backend is broken / untested
34-
for backend in ["-d:asyncBackend=none", "-d:asyncBackend=chronos"]:
33+
# TODO chronos backend uses nested waitFor which is not supported
34+
for backend in ["-d:asyncBackend=none"]:
3535
for threads in ["--threads:off", "--threads:on"]:
3636
for mode in ["-d:debug", "-d:release", "-d:danger"]:
3737
run backend & " " & threads & " " & mode, "tests/all_tests"
3838

39+
task testChronos, "Run chronos tests":
40+
# TODO chronos backend uses nested waitFor which is not supported
41+
for backend in ["-d:asyncBackend=chronos"]:
42+
for threads in ["--threads:off", "--threads:on"]:
43+
for mode in ["-d:debug", "-d:release", "-d:danger"]:
44+
run backend & " " & threads & " " & mode, "tests/all_tests"

faststreams/async_backend.nim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ const
2020
when asyncBackend == "none":
2121
discard
2222
elif asyncBackend == "chronos":
23+
{.warning: "chronos backend uses nested calls to `waitFor` which is not supported by chronos - it is not recommended to use it until this has been resolved".}
24+
2325
import
2426
chronos
2527

@@ -30,6 +32,8 @@ elif asyncBackend == "chronos":
3032
await f
3133

3234
elif asyncBackend == "asyncdispatch":
35+
{.warning: "asyncdispatch backend currently fails tests - it may or may not work as expected".}
36+
3337
import
3438
std/asyncdispatch
3539

0 commit comments

Comments
 (0)