[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
--- 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
no need to add a mid-variable, just use: STDERR.puts e.message
# incase of many error message when task-queue, ES does not work sleep(10)
end end@tq = TaskQueueAPI.new if error_message && error_message.includes?("3060': Connection refused") end
-- 2.23.0
On Mon, Mar 08, 2021 at 03:16:39PM +0800, Luan Shengde wrote:
--- 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
no need to add a mid-variable, just use: STDERR.puts e.message
ok
Thanks, Weitao
# incase of many error message when task-queue, ES does not work sleep(10)
end end@tq = TaskQueueAPI.new if error_message && error_message.includes?("3060': Connection refused") end
-- 2.23.0