示例#1
0
 def add_job(self, func: typing.Callable[[], typing.Coroutine], args=None, kwargs=None):
     if self._closing:
         raise ServerClosingException("Can not schedule job")
     job = Job(func, _task_vars=dump_task_vars(), args=args, kwargs=kwargs)
     self._pending.insert(0, job)
     self._schedule()
     return job
示例#2
0
 def add_job(self,
             func: typing.Callable[[], typing.Coroutine],
             request=None,
             args=None,
             kwargs=None):
     if self._closing:
         raise ServerClosingException('Can not schedule job')
     job = Job(func, request=request, args=args, kwargs=kwargs)
     self._pending.insert(0, job)
     self._schedule()
     return job