From 0e664e802f784e08b62da28d9303c677b3556147 Mon Sep 17 00:00:00 2001 From: Wedge Date: Mon, 3 Sep 2018 23:17:52 +0300 Subject: [PATCH] Retry file store check 3 times for package not found check --- app/services/abf_worker_service/base.rb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/services/abf_worker_service/base.rb b/app/services/abf_worker_service/base.rb index 13e183de9..c5ce9f3ba 100644 --- a/app/services/abf_worker_service/base.rb +++ b/app/services/abf_worker_service/base.rb @@ -60,11 +60,18 @@ module AbfWorkerService end end + TRIES = 3 + def filter_build_lists_without_packages(*build_lists) ids = [] build_lists = build_lists.flatten.select do |build_list| - sha1 = build_list.packages.pluck(:sha1).find do |sha1| - !FileStoreService::File.new(sha1: sha1).exist? + sha1 = nil + TRIES.times do + sha1 = build_list.packages.pluck(:sha1).find do |sha1| + !FileStoreService::File.new(sha1: sha1).exist? + end + break if sha1.present? + sleep 1 end if sha1.present? ids << build_list.id @@ -80,4 +87,4 @@ module AbfWorkerService end end -end \ No newline at end of file +end