수정 본
This commit is contained in:
@@ -40,16 +40,20 @@ class NaverWorker extends BaseCommand
|
||||
|
||||
while (true) {
|
||||
|
||||
// 1. DB 연결 상태 체크 (더 견고하게)
|
||||
// 1. DB 연결 상태 체크
|
||||
try {
|
||||
// connID가 없거나, 가벼운 쿼리 실행 실패 시 재연결 시도
|
||||
if ($this->db->connID === false || !$this->db->simpleQuery('SELECT 1')) {
|
||||
// 연결이 없으면 재연결 시도
|
||||
if ($this->db->connID === false) {
|
||||
$this->db->reconnect();
|
||||
CLI::write(CLI::color('🔄 Database reconnected.', 'yellow'));
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// 어떤 이유로든 에러 발생 시 재연결 시도
|
||||
$this->db->reconnect();
|
||||
try {
|
||||
$this->db->reconnect();
|
||||
} catch (\Throwable $reconnectError) {
|
||||
CLI::write(CLI::color('❌ Database reconnect failed: ' . $reconnectError->getMessage(), 'red'));
|
||||
}
|
||||
}
|
||||
|
||||
$result = $redis->brPop(['naver:raw_queue'], 30);
|
||||
|
||||
Reference in New Issue
Block a user