Skip to content

Commit

Permalink
remove concurrent processes on claims (#12849)
Browse files Browse the repository at this point in the history
  • Loading branch information
aherzberg authored May 31, 2023
1 parent 8ec8183 commit eb4eada
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions modules/mobile/app/services/mobile/v0/lighthouse_claims/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ module LighthouseClaims
class Proxy < Mobile::V0::Claims::Proxy
delegate :get_claim, to: :claims_service

def get_claims_and_appeals
claims = get_all_claims
appeals = get_all_appeals

full_list = []
errors = []

claims[:errors].nil? ? full_list.push(*claims[:list]) : errors.push(claims[:errors])
appeals[:errors].nil? ? full_list.push(*appeals[:list]) : errors.push(appeals[:errors])
data = claims_adapter.parse(full_list)

[data, errors]
end

private

def claims_adapter
Expand All @@ -21,17 +35,19 @@ def claims_service
end

def get_all_claims
lambda {
begin
claims_list = claims_service.get_claims
{
list: claims_list['data'],
errors: nil
}
rescue => e
{ list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'claims') }
end
claims_list = claims_service.get_claims
{
list: claims_list['data'],
errors: nil
}
rescue => e
{ list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'claims') }
end

def get_all_appeals
{ list: appeals_service.get_appeals(@user).body['data'], errors: nil }
rescue => e
{ list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'appeals') }
end
end
end
Expand Down

0 comments on commit eb4eada

Please sign in to comment.