allow add_task after server starts
This commit is contained in:
parent
04b04f094c
commit
8e3f3977bd
|
@ -86,6 +86,12 @@ class Sanic:
|
|||
|
||||
:param task: future, couroutine or awaitable
|
||||
"""
|
||||
try:
|
||||
if callable(task):
|
||||
self.loop.create_task(task())
|
||||
else:
|
||||
self.loop.create_task(task)
|
||||
except SanicException:
|
||||
@self.listener('before_server_start')
|
||||
def run(app, loop):
|
||||
if callable(task):
|
||||
|
|
Loading…
Reference in New Issue
Block a user