Skip to content

Commit

Permalink
Send config to summarize service
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyaray committed Jan 2, 2018
1 parent ea71fb0 commit c07b752
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions application/controllers/summary_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions application/services/summarize_folder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c07b752

Please sign in to comment.