Compare commits
No commits in common. "5a29373838739605a855f654c90b37df6064d178" and "8874a80ae296aaabe4d73c2e3b65bc6a6439acb5" have entirely different histories.
5a29373838
...
8874a80ae2
16
main.py
16
main.py
|
@ -1,9 +1,9 @@
|
||||||
import os, logging
|
import os
|
||||||
DEBUG = os.environ.get('DEBUG')
|
import logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
|
format='[%(asctime)s] %(levelname)s %(module)s/%(funcName)s - %(message)s',
|
||||||
level=logging.DEBUG if DEBUG else logging.INFO)
|
level=logging.DEBUG if os.environ.get('DEBUG') else logging.INFO)
|
||||||
logging.getLogger('aiohttp').setLevel(logging.DEBUG if DEBUG else logging.WARNING)
|
logging.getLogger('aiohttp').setLevel(logging.DEBUG if os.environ.get('DEBUG') else logging.WARNING)
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -79,17 +79,9 @@ def init():
|
||||||
signal(sig, disable_relays_on_exit)
|
signal(sig, disable_relays_on_exit)
|
||||||
logging.info('Signals initialized')
|
logging.info('Signals initialized')
|
||||||
|
|
||||||
async def feed_watchdog():
|
|
||||||
while True:
|
|
||||||
with open('/dev/watchdog', 'w') as wdt:
|
|
||||||
wdt.write('1')
|
|
||||||
await asyncio.sleep(1)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
init()
|
init()
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
if not DEBUG:
|
|
||||||
loop.create_task(feed_watchdog())
|
|
||||||
loop.run_until_complete(ws_listener())
|
loop.run_until_complete(ws_listener())
|
||||||
loop.close()
|
loop.close()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user