Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THREESCALE-11500: Fix confusing design flaw in "promote" UI (Part 1) #3953

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/subscribers/proxy_config_event_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
class ProxyConfigEventSubscriber
def call(event)
case event
when ProxyConfigs::AffectingObjectChangedEvent then ProxyConfigAffectingChangeWorker.perform_later(event.event_id)
else raise "Unknown event type #{event.class}"
when ProxyConfigs::AffectingObjectChangedEvent
proxy = Proxy.find(event.proxy_id)
proxy.affecting_change_history.touch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe keep the exception catching and some of the error handling from the worker?
I think the chance that proxy would not be found here, or any other issue occur is minimized here - unlike in the case when it's done via a background job (where things can happen until the job gets executed, like the proxy can be deleted etc.). But not sure, maybe we're missing some scenario where an exception can indeed be thrown?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the same thing but, if an error happens here, won't it end up in logs and bugsnag anyway? I assumed there were no need to manually catch and report errors from here. In fact, I'm not sure it was needed in the previous code.

else
raise "Unknown event type #{event.class}"
end
end
end
21 changes: 0 additions & 21 deletions app/workers/proxy_config_affecting_change_worker.rb

This file was deleted.

4 changes: 3 additions & 1 deletion test/subscribers/proxy_config_event_subscriber_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ class ProxyConfigEventSubscriberTest < ActiveSupport::TestCase
proxy_rule = FactoryBot.build_stubbed(:proxy_rule, proxy: proxy)
event = ProxyConfigs::AffectingObjectChangedEvent.create(proxy, proxy_rule)

ProxyConfigAffectingChangeWorker.expects(:perform_later).with(event.event_id)
Proxy.stubs(:find).with(event.proxy_id).returns(proxy)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need the stub? shouldn't the proxy be in the DB?


proxy.affecting_change_history.expects(:touch)

ProxyConfigEventSubscriber.new.call(event)
end
Expand Down
23 changes: 0 additions & 23 deletions test/workers/proxy_config_affecting_change_worker_test.rb

This file was deleted.