| 52 | |
| 53 | |
| 54 | class ServerHeartbeatHandler(ServerHeartbeatListener): |
| 55 | def started(self, event): |
| 56 | print("server heartbeat started", event) |
| 57 | |
| 58 | def succeeded(self, event): |
| 59 | global heartbeat_count, total_heartbeat_duration, streaming_heartbeat_count |
| 60 | heartbeat_count += 1 |
| 61 | total_heartbeat_duration += event.duration |
| 62 | if event.awaited: |
| 63 | streaming_heartbeat_count += 1 |
| 64 | print("server heartbeat succeeded", event) |
| 65 | |
| 66 | def failed(self, event): |
| 67 | global heartbeat_count, total_heartbeat_duration |
| 68 | heartbeat_count += 1 |
| 69 | total_heartbeat_duration += event.duration |
| 70 | print("server heartbeat failed", event) |
| 71 | |
| 72 | |
| 73 | class ConnectionHandler(ConnectionPoolListener): |