Skip to content

Instantly share code, notes, and snippets.

Created May 13, 2014
What would you like to do?
gevent-based service scheduling
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
# gevent
from gevent import spawn_later
# Zato
from zato.server.service import Service
class MyTarget(Service):
name = ''
def handle(self):'Target invoked with `%r`', self.request.raw_request)
class MyChannel(Service):
name = ''
def schedule(self, name, sleep, *args, **kwargs):
spawn_later(sleep, self.invoke, name=name, *args, **kwargs)
def handle(self):
self.schedule('', 60.0, payload='foo {}'.format(self.cid))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment