From c07b752fbad1d5843a5ede3f3c1395d8d3a57f42 Mon Sep 17 00:00:00 2001 From: Soumya Ray Date: Tue, 2 Jan 2018 14:57:15 +0800 Subject: [PATCH] Send config to summarize service --- application/controllers/summary_controller.rb | 1 + application/services/summarize_folder.rb | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/application/controllers/summary_controller.rb b/application/controllers/summary_controller.rb index a1656c8..b2d030c 100644 --- a/application/controllers/summary_controller.rb +++ b/application/controllers/summary_controller.rb @@ -21,6 +21,7 @@ class Api < Roda request_id = [request.env, request.path, Time.now.to_f].hash summarize_result = SummarizeFolder.new.call( + config: Api.config, repo: @repo, folder: folder, id: request_id diff --git a/application/services/summarize_folder.rb b/application/services/summarize_folder.rb index d8f20a7..93d425f 100644 --- a/application/services/summarize_folder.rb +++ b/application/services/summarize_folder.rb @@ -21,7 +21,7 @@ def clone_repo(input) Right(input) else clone_request_msg = clone_request_json(input) - notify_clone_listeners(clone_request_msg) + notify_clone_listeners(clone_request_msg, input[:config]) Left(Result.new(:processing, id: input[:id])) end rescue StandardError => error @@ -45,9 +45,9 @@ def clone_request_json(input) CloneRequestRepresenter.new(clone_request).to_json end - def notify_clone_listeners(message) - app.config.CLONE_LISTENERS.split.each do |queue_name| - queue_url = app.config.send(queue_name) + def notify_clone_listeners(message, config) + config.CLONE_LISTENERS.split.each do |queue_name| + queue_url = config.send(queue_name) report_queue = Messaging::Queue.new(queue_url) report_queue.send(message) end