From 56f56d008af4a0d85cc72718d60bcd2171247ff0 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Tue, 14 Feb 2017 15:15:15 +0000 Subject: [PATCH] Simplify trigger events (now guaranteeed to receive list of events) Don't bother checking if list empty - this function is not called often --- sanic/server.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sanic/server.py b/sanic/server.py index 8a7969e2..c4d3ad97 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -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,