def keep_wake(): resp = requests.get(keep_awake_url) log.debug('keep_wake', 'get', str(keep_awake_url), 'result', resp.status_code, resp.content)
break transfer.post_init() await runner.setup() await web.TCPSite(runner, host, port).start() async def stop() -> None: await runner.cleanup() await client.disconnect() try: loop.run_until_complete(start()) except Exception: log.fatal('Failed to initialize', exc_info=True) sys.exit(2) log.info('Initialization complete') log.debug(f'Listening at http://{host}:{port}') log.debug(f'Public URL prefix is {link_prefix}') log.debug(f'allowed user ids {allowed_user}') try: loop.run_forever() except KeyboardInterrupt: loop.run_until_complete(stop()) except Exception: log.fatal('Fatal error in event loop', exc_info=True) sys.exit(3)
def keep_wake(): resp = requests.get(keep_awake_url) log.debug('keep_wake', 'get', str(keep_awake_url), 'result', resp.status_code, resp.content) try: loop.run_until_complete(start()) except Exception: log.fatal('Failed to initialize', exc_info=True) sys.exit(2) log.info('Initialization complete') log.debug(f'Listening at http://{host}:{port}') log.debug(f'Public URL prefix is {link_prefix}') log.debug(f'allowed user ids {allowed_user}') log.debug(f'Debug={debug},show_index={show_index}') scheduler = BackgroundScheduler(timezone='Asia/Shanghai') try: if keep_awake: scheduler.add_job(keep_wake, 'interval', seconds=120) scheduler.start() loop.run_forever() except KeyboardInterrupt: if keep_awake: scheduler.shutdown() loop.run_until_complete(stop())
def keep_wake(): resp = requests.get(link_prefix) log.debug('keep_wake', 'get', link_prefix, 'result', resp.status_code)