fixing uncaught async exceptions due to missing await
fixes uncaught exceptions in the event loop. passing timeout and timeout_callback through.
This commit is contained in:
committed by
Emmanuel Gil Peyrot
parent
897610d819
commit
d4d542b741
@@ -34,7 +34,10 @@ class HttpUpload(slixmpp.ClientXMPP):
|
||||
|
||||
async def start(self, event):
|
||||
log.info('Uploading file %s...', self.filename)
|
||||
url = await self['xep_0363'].upload_file(self.filename)
|
||||
def timeout_callback(arg):
|
||||
raise TimeoutError("could not send message in time")
|
||||
url = await self['xep_0363'].upload_file(
|
||||
self.filename, timeout=10, timeout_callback=timeout_callback)
|
||||
log.info('Upload success!')
|
||||
|
||||
log.info('Sending file to %s', self.recipient)
|
||||
|
||||
Reference in New Issue
Block a user