(app, state, display)
| 490 | |
| 491 | |
| 492 | def capture_events(app, state, display): # pragma: no cover |
| 493 | |
| 494 | def on_connection_error(exc, interval): |
| 495 | print('Connection Error: {!r}. Retry in {}s.'.format( |
| 496 | exc, interval), file=sys.stderr) |
| 497 | |
| 498 | while 1: |
| 499 | print('-> evtop: starting capture...', file=sys.stderr) |
| 500 | with app.connection_for_read() as conn: |
| 501 | try: |
| 502 | conn.ensure_connection(on_connection_error, |
| 503 | app.conf.broker_connection_max_retries) |
| 504 | recv = app.events.Receiver(conn, handlers={'*': state.event}) |
| 505 | display.resetscreen() |
| 506 | display.init_screen() |
| 507 | recv.capture() |
| 508 | except conn.connection_errors + conn.channel_errors as exc: |
| 509 | print(f'Connection lost: {exc!r}', file=sys.stderr) |
| 510 | |
| 511 | |
| 512 | def evtop(app=None): # pragma: no cover |
no test coverage detected