Skip to content

Commit

Permalink
feat: Add stop condition in HealthMonitor (#710)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia authored Sep 11, 2024
1 parent 17c4632 commit f83d4a8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Monitor/HealthMonitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public function process(): void

// Monitor binLogCurrent
$this->timer->tick($this->monitorInterval, function () {
if ($this->consumer->isStopped()) {
return Timer::STOP;
}

if ($this->binLogCurrent instanceof BinLogCurrent) {
$this->logger?->debug(
'[{connection}] Health monitoring, binLogCurrent: [{binlog_current}]',
Expand All @@ -68,6 +72,10 @@ public function process(): void

// Health check and set snapshot
$this->timer->tick($this->snapShortInterval, function () {
if ($this->consumer->isStopped()) {
return Timer::STOP;
}

if (! $this->binLogCurrent instanceof BinLogCurrent) {
return;
}
Expand Down

0 comments on commit f83d4a8

Please sign in to comment.