M lib/low_balance.rb => lib/low_balance.rb +2 -0
@@ 5,6 5,8 @@ require_relative "transaction"
class LowBalance
def self.for(customer)
+ return Locked.new unless customer.registered?
+
ExpiringLock.new(
"jmp_customer_low_balance-#{customer.customer_id}",
expiry: 60 * 60 * 24 * 7
M sgx_jmp.rb => sgx_jmp.rb +1 -1
@@ 178,7 178,7 @@ EM.error_handler(&method(:panic))
def poll_for_notify(db)
db.wait_for_notify_defer.then { |notify|
- CustomerRepo.new.find(notify[:extra])
+ CustomerRepo.new(sgx_repo: Bwmsgsv2Repo.new).find(notify[:extra])
}.then(&LowBalance.method(:for)).then(&:notify!).then {
poll_for_notify(db)
}.catch(&method(:panic))