From 7dcdc6208dc8b69d2ba1ea9826f7bd7b226c690c Mon Sep 17 00:00:00 2001 From: "Ludovic Gasc (GMLudo)" Date: Thu, 20 Oct 2016 01:01:51 +0200 Subject: [PATCH] Enable after_start and before_stop callbacks for multiprocess --- sanic/sanic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanic/sanic.py b/sanic/sanic.py index 7198d854..310a2175 100644 --- a/sanic/sanic.py +++ b/sanic/sanic.py @@ -197,6 +197,8 @@ class Sanic: 'request_handler': self.handle_request, 'request_timeout': self.config.REQUEST_TIMEOUT, 'request_max_size': self.config.REQUEST_MAX_SIZE, + 'after_start': after_start, + 'before_stop': before_stop, 'loop': loop } @@ -209,8 +211,6 @@ class Sanic: try: if workers == 1: - server_settings['after_start'] = after_start - server_settings['before_stop'] = before_stop serve(**server_settings) else: log.info('Spinning up {} workers...'.format(workers))