Skip to content

Commit 65c0b2a

Browse files
committed
fix correctly
1 parent bcce0e2 commit 65c0b2a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/broly.nim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ proc getArgs():tuple[port:int, path:string] =
1717
else:
1818
result.path = key
1919

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+
2025
proc onRequest(req: Request): Future[void]{.async.} =
2126
var isSend:bool
2227
{.cast(gcsafe).}:
2328
for v in stubs:
2429
if req.httpMethod == v.stubMethod and req.path == v.stubPath:
2530
try:
2631
if v.stubSleepMs > 0:
27-
poll(v.stubSleepMS)
32+
await fdSleep(v.stubSleepMS)
2833
let status = v.stubStatus
2934
if v.stubContentType.isSome:
3035
let headers = v.stubContentType.get

0 commit comments

Comments
 (0)