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

Remove concurrent limiter for copay notifications #12953

Closed
wants to merge 7 commits into from
Closed
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
31 changes: 11 additions & 20 deletions app/workers/copay_notifications/new_statement_notification_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,21 @@ class NewStatementNotificationJob

sidekiq_options retry: false

def self.throttle
return Sidekiq::Limiter.unlimited if Rails.env.test?

Sidekiq::Limiter.concurrent('new-copay-statements', 4, wait_timeout: 259_200, lock_timeout: 120)
end

LIMITER = throttle
MCP_NOTIFICATION_TEMPLATE = Settings.vanotify.services.dmc.template_id.vha_new_copay_statement_email
STATSD_KEY_PREFIX = 'api.copay_notifications.new_statement'

def perform(statement)
LIMITER.within_limit do
StatsD.increment("#{STATSD_KEY_PREFIX}.total")
mpi_response = get_mpi_profile(identifier: statement['veteranIdentifier'],
identifier_type: statement['identifierType'],
facility_id: statement['facilityNum'])

if mpi_response.ok?
StatsD.increment("#{STATSD_KEY_PREFIX}.mpi.success")
create_notification_email_job(vet360_id: mpi_response.profile.vet360_id, icn: mpi_response.profile.icn)
else
StatsD.increment("#{STATSD_KEY_PREFIX}.mpi.failure")
raise mpi_response.error
end
StatsD.increment("#{STATSD_KEY_PREFIX}.total")
mpi_response = get_mpi_profile(identifier: statement['veteranIdentifier'],
identifier_type: statement['identifierType'],
facility_id: statement['facilityNum'])

if mpi_response.ok?
StatsD.increment("#{STATSD_KEY_PREFIX}.mpi.success")
create_notification_email_job(vet360_id: mpi_response.profile.vet360_id, icn: mpi_response.profile.icn)
else
StatsD.increment("#{STATSD_KEY_PREFIX}.mpi.failure")
raise mpi_response.error
end
end

Expand Down