diff --git a/README.md b/README.md index 90bc9b6..ac3ada9 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,9 @@ All arguments except for *job* are optional. # Bad: time.sleep(10) # Good: await asyncio.sleep(10) +import asyncio +import logging + async def custom_job(event, task_id): await asyncio.sleep(10) logging.info(f"{task_id}: execute example task: {event}") @@ -67,7 +70,8 @@ task_sched = TaskScheduler( files=True, dirs=False, delay=0, - logname="sched") + logname="sched", + global_vars=globals()) ``` ### ShellScheduler diff --git a/pyinotifyd/misc/config.py.default b/pyinotifyd/misc/config.py.default index 936d00d..510241c 100644 --- a/pyinotifyd/misc/config.py.default +++ b/pyinotifyd/misc/config.py.default @@ -2,14 +2,19 @@ # TaskScheduler config # ########################## +#import asyncio +#import logging +# #async def custom_job(event, task_id): +# asyncio.sleep(1) # logging.info(f"{task_id}: execute example task: {event}") # #task_sched = TaskScheduler( # job=custom_job, # files=True, # dirs=False, -# delay=10) +# delay=10 +# global_vars=globals()) ###########################