[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 | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/extract-stats/stats_worker.cr b/src/extract-stats/stats_worker.cr index 836d1f8..dbb3fe2 100644 --- a/src/extract-stats/stats_worker.cr +++ b/src/extract-stats/stats_worker.cr @@ -27,8 +27,11 @@ class StatsWorker end rescue e STDERR.puts e.message + error_message = e.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