From a62b538dcd84d1bf21dae3bd05261121df5ed667 Mon Sep 17 00:00:00 2001 From: Soumya Ray Date: Fri, 29 Dec 2017 22:55:15 +0800 Subject: [PATCH] Dynamically send clone notification to listener queues --- application/services/summarize_folder.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/services/summarize_folder.rb b/application/services/summarize_folder.rb index 38eea6a..3efd1fe 100644 --- a/application/services/summarize_folder.rb +++ b/application/services/summarize_folder.rb @@ -24,7 +24,7 @@ def clone_repo(input) # TODO: # - send message to worker using notify_clone_listeners? # - send repo to worker and let it find gitrepo - CloneRepoWorker.perform_async(clone_request_msg) + # CloneRepoWorker.perform_async(clone_request_msg) notify_clone_listeners(clone_request_msg) Left(Result.new(:processing, { id: input[:id] })) end @@ -50,8 +50,11 @@ def clone_request_json(input) end def notify_clone_listeners(message) - report_queue = Messaging::Queue.new(app.config.REPORT_QUEUE_URL) - report_queue.send(message) + app.config.CLONE_LISTENERS.split.each do |queue_name| + queue_url = app.config.send(queue_name) + report_queue = Messaging::Queue.new(queue_url) + report_queue.send(message) + end end end end