From af93a3781cb04205f6dc33a6c3e362e8d995593a Mon Sep 17 00:00:00 2001 From: Schimon Jehudah Date: Thu, 2 Nov 2023 12:05:43 +0000 Subject: [PATCH] Remove some print command and correct commented NOTE --- slixfeed/xmpphandler.py | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/slixfeed/xmpphandler.py b/slixfeed/xmpphandler.py index a2b395d..18ce82c 100644 --- a/slixfeed/xmpphandler.py +++ b/slixfeed/xmpphandler.py @@ -98,9 +98,8 @@ class Slixfeed(slixmpp.ClientXMPP): message = " ".join(msg["body"].split()) message = message.lower() - print(print_time(), "COMMAND ACCOUNT") - print("COMMAND:", message) - print("ACCOUNT: " + str(msg["from"])) + print(print_time(), "ACCOUNT: " + str(msg["from"])) + print(print_time(), "COMMAND:", message) if message.startswith("help"): action = print_help() @@ -150,9 +149,7 @@ class Slixfeed(slixmpp.ClientXMPP): elif message.startswith("stop"): # action = "Updates are disabled." try: - print(print_time(), "task_manager[jid]") - print(task_manager[jid]) - task_manager[jid]["check"].cancel() + # task_manager[jid]["check"].cancel() # task_manager[jid]["status"].cancel() task_manager[jid]["interval"].cancel() key = "enabled" @@ -160,12 +157,13 @@ class Slixfeed(slixmpp.ClientXMPP): action = await initdb(jid, sqlitehandler.set_settings_value, [key, val]) except: action = "Updates are already disabled." - print("Updates are already disabled. Nothing to do.") + # print("Updates are already disabled. Nothing to do.") # await self.send_status(jid) + await self.task_jid(jid) else: action = "Unknown command. Press \"help\" for list of commands" # NOTE Message won't be sent if status is send before it - # await self.send_status(jid) + # Or it is because we cancel task send_status if action: msg.reply(action).send() @@ -195,20 +193,11 @@ class Slixfeed(slixmpp.ClientXMPP): # jid_tasker[jid] = asyncio.create_task(self.task_jid(jid)) # await jid_tasker[jid] async with asyncio.TaskGroup() as tg: - print("main task") - print(print_time(), "repr(tg)") - print(repr(tg)) # for file in files: if file.endswith(".db") and not file.endswith(".db-jour.db"): jid = file[:-3] tg.create_task(self.task_jid(jid)) # task_manager.update({jid: tg}) - # print(task_manager) # {} - print(print_time(), "repr(tg) id(tg)") - print(jid, repr(tg)) # sch@pimux.de - print(jid, id(tg)) # sch@pimux.de 139879835500624 - # - # 139879835500624 async def task_jid(self, jid): @@ -225,10 +214,6 @@ class Slixfeed(slixmpp.ClientXMPP): ) print(print_time(), "enabled", enabled, jid) if enabled: - print("sub task") - print(print_time(), "repr(self) id(self)") - print(repr(self)) - print(id(self)) task_manager[jid] = {} task_manager[jid]["check"] = asyncio.create_task(check_updates(jid)) task_manager[jid]["status"] = asyncio.create_task(self.send_status(jid)) @@ -236,12 +221,6 @@ class Slixfeed(slixmpp.ClientXMPP): await task_manager[jid]["check"] await task_manager[jid]["status"] await task_manager[jid]["interval"] - print(print_time(), "task_manager[jid].items()") - print(task_manager[jid].items()) - print(print_time(), "task_manager[jid]") - print(task_manager[jid]) - print(print_time(), "task_manager") - print(task_manager) else: await self.send_status(jid) @@ -339,13 +318,6 @@ class Slixfeed(slixmpp.ClientXMPP): """ if jid in task_manager: task_manager[jid][key].cancel() - loop = asyncio.get_event_loop() - print(print_time(), "loop") - print(loop) - print(print_time(), "loop.time()") - print(print_time(), loop.time()) - print(print_time(), "self.loop.time()") - print(print_time(), self.loop.time()) task_manager[jid][key] = loop.call_at( loop.time() + 60 * float(val), loop.create_task,