Skip to content

Commit

Permalink
APPEALS-22705 Fixed Caseflow Stuck Records assocation. Refactored RSPEC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron-Willis committed Jul 13, 2023
1 parent aaf65e3 commit 62d2177
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 97 deletions.
3 changes: 1 addition & 2 deletions app/models/end_product_establishment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class EndProductEstablishment < CaseflowRecord
# # It is NOT recommended to go below 0.01. (default: 0.1)
# :expire => 10 # Specify in seconds when the lock should be considered stale when something went wrong
# # with the one who held the lock and failed to unlock. (default: 10)
auto_mutex :sync!, block: 60, expire: 100, after_failure: lambda { Rails.logger.error('failed to acquire lock! EPE sync is being called by another process. Please try again later.') }
# auto_mutex :sync!, block: 60, expire: 100, after_failure: lambda { Rails.logger.error('failed to acquire lock! EPE sync is being called by another process. Please try again later.') }

# allow @veteran to be assigned to save upstream calls
attr_writer :veteran
Expand Down Expand Up @@ -211,7 +211,6 @@ def cancel_unused_end_product!
end

def sync!
sleep(1)
# There is no need to sync end_product_status if the status
# is already inactive since an EP can never leave that state
return true unless status_active?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PriorityEndProductSyncQueue < CaseflowRecord

belongs_to :end_product_establishment
belongs_to :batch_process, foreign_key: "batch_id", primary_key: "batch_id"
has_one :caseflow_stuck_record, as: :stuck_record
has_many :caseflow_stuck_records, as: :stuck_record

scope :completed_or_unbatched, -> { where(batch_id: [nil, BatchProcess.completed_batch_process_ids]) }
scope :batchable, -> { where("last_batched_at IS NULL OR last_batched_at <= ?", BatchProcess::ERROR_DELAY.hours.ago) }
Expand Down

This file was deleted.

89 changes: 0 additions & 89 deletions spec/models/priority_end_product_sync_queue_spec.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,30 @@
end
end
end

let!(:end_product_establishment) do
EndProductEstablishment.create(
payee_code: "10",
source_id: 1,
source_type: "HigherLevelReview",
veteran_file_number: 1
)
end

let!(:pepsq) do
PriorityEndProductSyncQueue.create(
batch_id: nil,
created_at: Time.zone.now,
end_product_establishment_id: end_product_establishment.id,
error_messages: [],
last_batched_at: nil,
status: "PRE_PROCESSING"
)
end

context "#end_product_establishment" do
it "will return the End Product Establishment object" do
expect(pepsq.end_product_establishment).to eq(end_product_establishment)
end
end
end

0 comments on commit 62d2177

Please sign in to comment.