-
-
Save niv/5e50fef3a33ba52cdfa6654822e80c7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc redisCommand*(redis: Redis, command: seq[string]): | |
Future[RedisReply] {.async.} = | |
## Execute a redis command. | |
echo "command: ", command | |
await ( Future[void](redis.socketAvailable) ) | |
doAssert(finished(redis.socketAvailable)) | |
echo "cleaning" | |
FutureVar[void](redis.socketAvailable).clean() | |
doAssert(not finished(redis.socketAvailable)) | |
redis.writeCommand(command) | |
result = await readResponse(redis) | |
echo "completing sockAvail on " & $command | |
redis.socketAvailable.complete() | |
command: @[GET, 0] | |
cleaning | |
completing sockAvail on @[GET, 0] | |
completing sockAvail on @[GET, 0] | |
Traceback (most recent call last) | |
Error: unhandled exception: An attempt was made to complete a Future more than once. Details: | |
Future ID: 2 | |
Created in proc: redis.inflight(10.2.1.7:6379) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment