Timer bootstep.
| 30 | |
| 31 | |
| 32 | class Timer(bootsteps.Step): |
| 33 | """Timer bootstep.""" |
| 34 | |
| 35 | def create(self, w): |
| 36 | if w.use_eventloop: |
| 37 | # does not use dedicated timer thread. |
| 38 | w.timer = _Timer(max_interval=10.0) |
| 39 | else: |
| 40 | if not w.timer_cls: |
| 41 | # Default Timer is set by the pool, as for example, the |
| 42 | # eventlet pool needs a custom timer implementation. |
| 43 | w.timer_cls = w.pool_cls.Timer |
| 44 | w.timer = self.instantiate(w.timer_cls, |
| 45 | max_interval=w.timer_precision, |
| 46 | on_error=self.on_timer_error, |
| 47 | on_tick=self.on_timer_tick) |
| 48 | |
| 49 | def on_timer_error(self, exc): |
| 50 | logger.error('Timer error: %r', exc, exc_info=True) |
| 51 | |
| 52 | def on_timer_tick(self, delay): |
| 53 | logger.debug('Timer wake-up! Next ETA %s secs.', delay) |
| 54 | |
| 55 | |
| 56 | class Hub(bootsteps.StartStopStep): |
no outgoing calls
searching dependent graphs…