Replies: 4 comments
-
Hmmm ... looks to me like you are using Python (and specifically pydbus). I'm not exactly sure what you are trying to accomplish. If I understand correctly, you want to be able to simultaneously process a new Message Received signal while still processing the old one. I hadn't thought of that possibility, and I'm guessing from your posting that Python will process only one signal at a time (which is good news for me, as it would create quite a mess if it started to process a new message at the same time it was processing an older one -- in which case I would need to install locks and checks, which I probably ought to do anyhow as I don't know whether pydbus allows such overlapping). You might want to take a look at https://github.com/johnfreed/signalmail/blob/master/signalmail.py and see if that has any relevance to your question. |
Beta Was this translation helpful? Give feedback.
-
Thanks. sorry for the unclearity. I have build a simple signal bot using signal-cli. Everyone asking a question to the bot has to wait for that request is finished before their question is processed. I would like to prevent that. Thanks for the link. Thats an interesting project. But it is not asynchronous as far ad I can tell |
Beta Was this translation helpful? Give feedback.
-
I don't have a concrete advice, because the implementation depends on the event loop you're using. I'm not familiar with GLib's event loop, but its documentation might provide some info on how to run a function "in the background". There are additional libraries that combine a more pythonic Finally, with signal-cli's the new JSON interface, you can ditch dbus entirely, and use any event loop you want, e.g. good ol' select, asyncio or anything else. Sorry this is only a general overview! |
Beta Was this translation helpful? Give feedback.
-
I created a Signal bot in Perl and here I register an asynchronous callback for function calls (using promises) that need to wait on replies and use a select() on a file handle where I subscribed to messages on Dbus to query for incoming messages. I'm sure Python will offer similar things if you know what you're looking for. |
Beta Was this translation helpful? Give feedback.
-
Hi All,
currently I use the dbus like this:
How can I make this asynchronous? So that we can call msgRcv before the previous call has ended?
I have been investigating asyncio and dbus next but I seem unable to get how it works.
Can anyone give me an example?
Beta Was this translation helpful? Give feedback.
All reactions