(self)
| 28 | self._prefix = prefix |
| 29 | |
| 30 | def run(self): |
| 31 | wait_until = default_timer() |
| 32 | while True: |
| 33 | while True: |
| 34 | now = default_timer() |
| 35 | if now >= wait_until: |
| 36 | # May need to skip some pushes. |
| 37 | while wait_until < now: |
| 38 | wait_until += self._interval |
| 39 | break |
| 40 | # time.sleep can return early. |
| 41 | time.sleep(wait_until - now) |
| 42 | try: |
| 43 | self._pusher.push(prefix=self._prefix) |
| 44 | except OSError: |
| 45 | logging.exception("Push failed") |
| 46 | |
| 47 | |
| 48 | class GraphiteBridge: |