Ext-Creators/discord-ext-ipc

'Await' statement blocking further code execution when run via ipc

Pianoplayer1 opened this issue · 0 comments

Description

In a function I have that sends messages to a specific channel, there is (obviously) an await channel.send(...) line to actually send the message. Whenever this function is run via the ipc server though, the code past this line never gets executed - the message itself is sent without a problem, but the execution stops at the await and seemingly never returns from that statement.
I am pretty sure this problem is caused by the ipc module, because when I transform the function into a regular discord bot command, everything works fine and as expected.

Behavior

The message gets sent to the specified channel, but code after that sending operation is completely ignored and never runs. With that, it is also impossible to run the function again, as it is still stuck in that instance.
There are no errors whatsoever, just nothing happens.

Reproduction Steps

Here is the server code:

class Bot(commands.Bot):
    self.ipc = ipc.Server(self, secret_key="abc")
    ...

bot = Bot()
bot.ipc.start()
bot.run()

@Bot.ipc.route()
async def send_message(channel_id):
    await client.get_channel(channel_id).send('hi')
    print('hi')

And the client:

ipc_client = ipc.Client(secret_key='abc')

async def request():
    await ipc_client.request('send_message', channel_id=...)

First, I started the server (which went fine and without errors), then ran the client function a few times with the above described results - the 'hi' never gets printed.

System Information

Python 3.9.4
discord.py 1.7.3
discord-ext-ipc 2.1.1