Hello the list,

I want to ask for help with my application. It is a rather trivial group
chat written in Python using the Python Qpid Proton library and the Tkinter
library for GUI.

I have two problems regarding this application.

First, I want to ask if I designed it correctly. I am spawning two threads
and one is running the Tk event loop and the other is running the proton
reactor. The on_sendable handler in the reactor is setting a
flag self.ready_to_send = True and if this is set when the Send button is
pushed, then the Tk thread will send all messages in a
multiprocessing.Queue() and set flag back to False, otherwise it will add
the new message to a queue. I could not think of any other way than using
threads.

Second, the chat is not working properly now. What seems to be happening is
that the reactor is not sending the messages the moment
self.sender.send(message) is called, but they are sent in bunches of two,
three or even more. Anybody has any idea what I might be doing wrong? I am
rather certain it is nothing I do with the multiprocessing.Queue() because
same behavior happens if I just call reactor.sender.send() directly,
disregarding the ready_to_send flag and anything.

The application is at https://github.com/jdanekrh/reactive_messaging_app,
see a quick demo at https://www.youtube.com/watch?v=OGGdeEx7nZ8 (31
seconds) which shows the behavior I described in my second question.

Thanks for any help,
-- 
Jiří Daněk

Reply via email to