Simplify trigger events (now guaranteeed to receive list of events)
Don't bother checking if list empty - this function is not called often
This commit is contained in:
parent
1866e4ef44
commit
56f56d008a
|
@ -256,13 +256,10 @@ def trigger_events(events, loop):
|
|||
:param events: one or more sync or async functions to execute
|
||||
:param loop: event loop
|
||||
"""
|
||||
if events:
|
||||
if not isinstance(events, list):
|
||||
events = [events]
|
||||
for event in events:
|
||||
result = event(loop)
|
||||
if isawaitable(result):
|
||||
loop.run_until_complete(result)
|
||||
for event in events:
|
||||
result = event(loop)
|
||||
if isawaitable(result):
|
||||
loop.run_until_complete(result)
|
||||
|
||||
|
||||
def serve(host, port, request_handler, error_handler, before_start=None,
|
||||
|
|
Loading…
Reference in New Issue
Block a user