Laura: Fix awaitable error 4d03d6e16e
This commit is contained in:
parent
b2387a700d
commit
7ee4000ee0
1 changed files with 13 additions and 5 deletions
|
@ -361,11 +361,14 @@ async def refresh_task(self, jid, callback, key, val=None):
|
||||||
task_manager[jid][key].cancel()
|
task_manager[jid][key].cancel()
|
||||||
except:
|
except:
|
||||||
print("No task of type", key, "to cancel for JID", jid)
|
print("No task of type", key, "to cancel for JID", jid)
|
||||||
task_manager[jid][key] = loop.call_at(
|
# task_manager[jid][key] = loop.call_at(
|
||||||
loop.time() + 60 * float(val),
|
# loop.time() + 60 * float(val),
|
||||||
loop.create_task,
|
# loop.create_task,
|
||||||
(callback(self, jid))
|
# (callback(self, jid))
|
||||||
# send_update(jid)
|
# # send_update(jid)
|
||||||
|
# )
|
||||||
|
task_manager[jid][key] = loop.create_task(
|
||||||
|
wait_and_run(self, callback, jid, val)
|
||||||
)
|
)
|
||||||
# task_manager[jid][key] = loop.call_later(
|
# task_manager[jid][key] = loop.call_later(
|
||||||
# 60 * float(val),
|
# 60 * float(val),
|
||||||
|
@ -379,6 +382,11 @@ async def refresh_task(self, jid, callback, key, val=None):
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
|
||||||
|
async def wait_and_run(self, callback, jid, val):
|
||||||
|
await asyncio.sleep(60 * float(val))
|
||||||
|
await callback(self, jid)
|
||||||
|
|
||||||
|
|
||||||
# TODO Take this function out of
|
# TODO Take this function out of
|
||||||
# <class 'slixmpp.clientxmpp.ClientXMPP'>
|
# <class 'slixmpp.clientxmpp.ClientXMPP'>
|
||||||
async def check_updates(jid):
|
async def check_updates(jid):
|
||||||
|
|
Loading…
Reference in a new issue