def __init__(self, till=None, timeout=None, seconds=None): global next_ping now = time() if till != None: if not isinstance(till, (float, int)): from mo_logs import Log Log.error("Date objects for Till are no longer allowed") timeout = till elif seconds != None: timeout = now + seconds elif timeout != None: if not isinstance(timeout, (float, int)): from mo_logs import Log Log.error("Duration objects for Till are no longer allowed") timeout = now + timeout Signal.__init__(self, name=unicode(timeout)) with _till_locker: if timeout != None: next_ping = min(next_ping, timeout) Till.new_timers.append((timeout, self))
def __init__(self, till=None, timeout=None, seconds=None): now = time() if till != None: if not isinstance(till, (float, int)): from mo_logs import Log Log.error("Date objects for Till are no longer allowed") timeout = till elif seconds != None: timeout = now + seconds elif timeout != None: if not isinstance(timeout, (float, int)): from mo_logs import Log Log.error("Duration objects for Till are no longer allowed") timeout = now + timeout else: from mo_logs import Log Log.error("Should not happen") Signal.__init__(self, name=text_type(timeout)) with Till.locker: if timeout != None: Till.next_ping = min(Till.next_ping, timeout) Till.new_timers.append((timeout, ref(self)))
def __init__(self, till=None, seconds=None): """ ONE OF THESE PARAMETERS IS REQUIRED :param till: UNIX TIMESTAMP OF WHEN TO SIGNAL :param seconds: PREFERRED OVER timeout """ now = time() if till != None: if not isinstance(till, (float, int)): from mo_logs import Log Log.error("Date objects for Till are no longer allowed") timeout = till elif seconds != None: timeout = now + seconds else: raise Log.error("Should not happen") Signal.__init__(self, name=text_type(timeout)) with Till.locker: if timeout != None: Till.next_ping = min(Till.next_ping, timeout) Till.new_timers.append(TodoItem(timeout, ref(self)))
def __init__(self, till=None, seconds=None): """ ONE OF THESE PARAMETERS IS REQUIRED :param till: UNIX TIMESTAMP OF WHEN TO SIGNAL :param seconds: PREFERRED OVER timeout """ now = time() if till != None: if not isinstance(till, (float, int)): from mo_logs import Log Log.error("Date objects for Till are no longer allowed") timeout = till elif seconds != None: timeout = now + seconds else: from mo_logs import Log raise Log.error("Should not happen") Signal.__init__(self, name=text_type(timeout)) with Till.locker: if timeout != None: Till.next_ping = min(Till.next_ping, timeout) Till.new_timers.append(TodoItem(timeout, ref(self)))
def __init__(self, till=None, timeout=None, seconds=None): now = time() if till != None: if not isinstance(till, (float, int)): from mo_logs import Log Log.error("Date objects for Till are no longer allowed") timeout = till elif seconds != None: timeout = now + seconds elif timeout != None: if not isinstance(timeout, (float, int)): from mo_logs import Log Log.error("Duration objects for Till are no longer allowed") timeout = now + timeout Signal.__init__(self, name=unicode(timeout)) with Till.locker: if timeout != None: Till.next_ping = min(Till.next_ping, timeout) Till.new_timers.append((timeout, self))