Example #1
0
async def loop_set_device(event_loop: asyncio.BaseEventLoop):
    try:
        while event_loop.is_running():
            normalize_volume()
            await asyncio.sleep(CONFIG.SLEEP_INTERVAL)
    except asyncio.CancelledError:
        await asyncio.sleep(0)
Example #2
0
async def crawl_loop(event_loop: asyncio.BaseEventLoop):
    try:
        while event_loop.is_running():
            for site_data in config.site_requirements:
                url = next(iter(site_data))
                content = site_data[url]
                print("Checking URL: {}".format(url))
                print("For content: {}".format(content))
                crawler.load_page(CONFIG.LOGPATH, url, content)
            print("Waiting {} seconds until checking the sites again.".format(
                period))
            await asyncio.sleep(float(period))
    except asyncio.CancelledError:
        print("Stopping")
        await asyncio.sleep(1)