Move gc and wdt to function

This commit is contained in:
Jimmy 2025-08-03 19:39:25 +12:00
parent 50545e3170
commit 2a7b5527a5
1 changed files with 9 additions and 7 deletions

View File

@ -25,7 +25,14 @@ async def main():
async def tick(): async def tick():
while True: while True:
patterns.tick() patterns.tick()
await asyncio.sleep_ms(1) await asyncio.sleep_ms(0)
async def system():
while True:
gc.collect()
for i in range(60):
wdt.feed()
await asyncio.sleep(1)
w = web(settings, patterns) w = web(settings, patterns)
print(settings) print(settings)
@ -37,14 +44,9 @@ async def main():
asyncio.create_task(tick()) asyncio.create_task(tick())
asyncio.create_task(p2p(settings, patterns)) asyncio.create_task(p2p(settings, patterns))
asyncio.create_task(system())
while True:
#print(time.localtime())
gc.collect()
for i in range(20):
wdt.feed()
await asyncio.sleep_ms(1000)
# cleanup before ending the application # cleanup before ending the application
await server await server