KxSystems / pyq

PyQ — Python for kdb+
http://code.kx.com/q/interfaces
Apache License 2.0
191 stars 49 forks source link

Async messages get queued until sync message #146

Closed Kamatayon closed 1 year ago

Kamatayon commented 1 year ago

Questions

Steps to reproduce the issue

Send asynchronous request using pyq. Q process accepting requests:

.z.ps:{show "Async"} Python code:

from pyq import q
h = q.hopen('::5001')
h.neg('a')

Expected result

Q process receives request and print "Async"

Actual result

For some reason all async requests are placed in some sort of queue and until you make sync reuest, they are not sent.

h.neg('a') # nothing happens
h('b') # you get error since no sync message handler is defined, but the message above gets sent

Workaround

You could send sync message every time you've prepared async message, but at this point you could just switch to sync messages

Kamatayon commented 1 year ago

Just to make it clear for someone who will may be read it, async messages are placed in queue which you can either flush or follow wtih sync chaser. https://code.kx.com/q/basics/ipc/#async-message-set