Enable after_start and before_stop callbacks for multiprocess
This commit is contained in:
parent
f5569f1723
commit
7dcdc6208d
|
@ -197,6 +197,8 @@ class Sanic:
|
||||||
'request_handler': self.handle_request,
|
'request_handler': self.handle_request,
|
||||||
'request_timeout': self.config.REQUEST_TIMEOUT,
|
'request_timeout': self.config.REQUEST_TIMEOUT,
|
||||||
'request_max_size': self.config.REQUEST_MAX_SIZE,
|
'request_max_size': self.config.REQUEST_MAX_SIZE,
|
||||||
|
'after_start': after_start,
|
||||||
|
'before_stop': before_stop,
|
||||||
'loop': loop
|
'loop': loop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,8 +211,6 @@ class Sanic:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if workers == 1:
|
if workers == 1:
|
||||||
server_settings['after_start'] = after_start
|
|
||||||
server_settings['before_stop'] = before_stop
|
|
||||||
serve(**server_settings)
|
serve(**server_settings)
|
||||||
else:
|
else:
|
||||||
log.info('Spinning up {} workers...'.format(workers))
|
log.info('Spinning up {} workers...'.format(workers))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user