Skip to content

Commit

Permalink
Don't start every MetricsCollectorWorker
Browse files Browse the repository at this point in the history
Fix the `#workers` method for any worker that includes the
PerEmsTypeWorkerMixin (aka just the MetricsCollectorWorkers).

This was setting an instance variable `@workers` but this wasn't
actually being called so the ivar was never set up.  This led to every
metrics collector worker for every EMS type to be started if the role
was enabled.
  • Loading branch information
agrare committed Jan 3, 2020
1 parent 6bf7f94 commit 5cb0e6b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/models/mixins/per_ems_type_worker_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ module PerEmsTypeWorkerMixin

included do
self.check_for_minimal_role = false
@workers = lambda do
return 0 unless self.any_valid_ems_in_zone?
workers_configured_count
end
end

module ClassMethods
def workers
return 0 unless any_valid_ems_in_zone?

super
end

def ems_class
parent
end
Expand Down

0 comments on commit 5cb0e6b

Please sign in to comment.