cheatfate / asyncpg

Asynchronous PostgreSQL driver for Nim language
MIT License
59 stars 6 forks source link

cannot recieve notify from another connection. #3

Open slangmgh opened 6 years ago

slangmgh commented 6 years ago

Notify can only recieve when sendNotify is send through the same connection with the notify.

proc testConnectionNotify(conn, conn2: apgConnection): Future[bool] {.async.} =
  var r1 = false
  var r2 = false
  await conn.listenNotify("testChannel")
  var notifyFuture1 = conn.notify("testChannel")
  await conn2.sendNotify("testChannel", "payload")
  #await conn.sendNotify("testChannel", "payload")
  var sleepFuture1 = sleepAsync(100)
  await notifyFuture1 or sleepFuture1
  if notifyFuture1.finished:
    echo notifyFuture1.read.payload
    r1 = true
    return true
  else:
    echo "failed"
    return false
geohuz commented 3 years ago

I'm encountering the same issue for now, is there any solution?