Skip to content

Commit 8207a93

Browse files
committed
May as well only run under async when we need
1 parent e101a27 commit 8207a93

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sleep_inhibitor.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,14 @@ def init():
201201
plugin_dir, inhibitor_prog)
202202
for index, plugin in enumerate(plugins, 1)]
203203

204-
async def run():
205-
'Main entry'
206-
tasks = init()
207-
208-
# Wait for each plugin task to finish (i.e. wait forever)
204+
async def run(tasks):
205+
'Wait for each plugin task to finish (i.e. wait forever)'
209206
await asyncio.gather(*(t.run() for t in tasks))
210207

211208
def main():
212-
asyncio.run(run())
209+
'Main entry'
210+
tasks = init()
211+
asyncio.run(run(tasks))
213212

214213
if __name__ == '__main__':
215214
main()

0 commit comments

Comments
 (0)