We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcce0e2 commit 65c0b2aCopy full SHA for 65c0b2a
src/broly.nim
@@ -17,14 +17,19 @@ proc getArgs():tuple[port:int, path:string] =
17
else:
18
result.path = key
19
20
+proc fdSleep(ms: int): Future[void] =
21
+ var res = newFuture[void]()
22
+ addTimer(ms, true, proc (fd: AsyncFD): bool = res.complete(); return true)
23
+ return res
24
+
25
proc onRequest(req: Request): Future[void]{.async.} =
26
var isSend:bool
27
{.cast(gcsafe).}:
28
for v in stubs:
29
if req.httpMethod == v.stubMethod and req.path == v.stubPath:
30
try:
31
if v.stubSleepMs > 0:
- poll(v.stubSleepMS)
32
+ await fdSleep(v.stubSleepMS)
33
let status = v.stubStatus
34
if v.stubContentType.isSome:
35
let headers = v.stubContentType.get
0 commit comments