Hello:
How can i use a redis call with spawn syntax?
I tried:
import os, times, posix, logging, redis, threadpool
{.experimental.}
var running = true
proc proc_spawned() =
let redis_con = redis.open()
defer: redis_con.quit
while running == true:
echo("bRPop")
discard redis_con.bRPop("test", 1000)
os.sleep(1000)
spawn proc_spawned()
The problem only happens with Redis.bRPop proc. Any ideas?
proc bRPop*(r: Redis, keys: varargs[string], timeout: int): RedisList =
## Remove and get the *last* element in a list, or block until one
## is available.
var args: seq[string] = @[]
for i in items(keys): args.add(i)
args.add($timeout)
r.sendCommand("BRPOP", args)
return r.readArray()