Skip to content

Commit

Permalink
Move lock
Browse files Browse the repository at this point in the history
  • Loading branch information
pskl committed Nov 25, 2024
1 parent 055f86d commit ca96c8d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/services/pfmp_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def update!(params)
params = params.to_h.with_indifferent_access

Pfmp.transaction do
pfmp.lock!
pfmp.schooling.lock! # prevent race condition using pessimistic locking (blocks r+w)

pfmp.update!(params)
recalculate_amounts! if params[:day_count].present?
transition!
Expand Down

0 comments on commit ca96c8d

Please sign in to comment.