コード例 #1
0
ファイル: threadgroup.py プロジェクト: rhel-osp/neutron
 def add_dynamic_timer(self,
                       callback,
                       initial_delay=None,
                       periodic_interval_max=None,
                       *args,
                       **kwargs):
     timer = loopingcall.DynamicLoopingCall(callback, *args, **kwargs)
     timer.start(initial_delay=initial_delay,
                 periodic_interval_max=periodic_interval_max)
     self.timers.append(timer)
コード例 #2
0
ファイル: sync.py プロジェクト: insequent/calico-neutron
def _start_loopingcall(min_chunk_size, state_sync_interval, func):
    """Start a loopingcall for the synchronization task."""
    # Start a looping call to synchronize operational status
    # for neutron resources
    if not state_sync_interval:
        # do not start the looping call if specified
        # sync interval is 0
        return
    state_synchronizer = loopingcall.DynamicLoopingCall(
        func, sp=SyncParameters(min_chunk_size))
    state_synchronizer.start(periodic_interval_max=state_sync_interval)
    return state_synchronizer