mirror of
https://github.com/status-im/nim-raft.git
synced 2025-01-31 15:26:27 +00:00
31 lines
827 B
Nim
31 lines
827 B
Nim
# nim-raft
|
|
# Copyright (c) 2023 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
# at your option.
|
|
# This file may not be copied, modified, or distributed except according to
|
|
# those terms.
|
|
|
|
import asyncdispatch, httpclient
|
|
|
|
proc nonAsyncHttp() =
|
|
var client = newHttpClient()
|
|
echo "Non async started"
|
|
for i in 0 .. 30:
|
|
let resp = client.get("http://example.com")
|
|
echo resp.status
|
|
echo "Non async finished"
|
|
|
|
proc asyncHttp() {.async.} =
|
|
var client = newAsyncHttpClient()
|
|
echo "Async started"
|
|
for i in 0 .. 30:
|
|
let resp = await client.get("http://example.com")
|
|
echo resp.status
|
|
echo "Async finished"
|
|
|
|
|
|
waitFor asyncHttp()
|
|
nonAsyncHttp()
|