Skip to content

Commit

Permalink
Auto reconnect when the socket disconnected (#349)
Browse files Browse the repository at this point in the history
Co-authored-by: Deeka Wong <[email protected]>
  • Loading branch information
huangdijia and huangdijia committed Sep 22, 2023
1 parent c94e222 commit 882b888
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Consumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
use Hyperf\Coroutine\Coroutine;
use MySQLReplication\Config\ConfigBuilder;
use MySQLReplication\MySQLReplicationFactory;
use Throwable;
use MySQLReplication\Socket\SocketException;

use function Hyperf\Support\make;
use function Hyperf\Tappable\tap;
Expand Down Expand Up @@ -100,8 +100,8 @@ public function start(): void

try {
$replication->consume();
} catch (Throwable $e) {
$this->warning((string) $e);
} catch (SocketException $e) {
$replication->connect();
}
}
};
Expand Down

0 comments on commit 882b888

Please sign in to comment.