[Why] the connection between stats_worker and task-queue may be interrupted, and the old connection will be disable, so stats_worker need create a new connection with task-queue
Signed-off-by: Lu Weitao luweitaobe@163.com --- src/extract-stats/stats_worker.cr | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/extract-stats/stats_worker.cr b/src/extract-stats/stats_worker.cr index 836d1f8..da4dbce 100644 --- a/src/extract-stats/stats_worker.cr +++ b/src/extract-stats/stats_worker.cr @@ -26,9 +26,12 @@ class StatsWorker @tq.delete_task(queue_path + "/in_process", "#{job_id}") end rescue e - STDERR.puts e.message + error_message = e.message + STDERR.puts error_message + # incase of many error message when task-queue, ES does not work sleep(10) + @tq = TaskQueueAPI.new if error_message && error_message.includes?("3060': Connection refused") end end end