diff --git a/bin/sim_job b/bin/sim_job index 06816e3c66fcad08a175a1f8a6f3df8dcddffe03..2d9e6ed832f6355aac99cc50e58ee5f71e2f6b2f 100755 --- a/bin/sim_job +++ b/bin/sim_job @@ -65,6 +65,7 @@ CONFIG[:creds] = {} require_relative "../lib/async_braintree" require_relative "../lib/blather_notify" require_relative "../lib/customer_repo" +require_relative "../lib/expiring_lock" require_relative "../lib/low_balance" require_relative "../lib/postgres" require_relative "../lib/sim_repo" @@ -170,10 +171,12 @@ class SimWarn include SimAction def notify - m = Blather::Stanza::Message.new - m.body = "Your SIM #{iccid} only has " \ - "#{(@sim.remaining_usage_kb / 1024).to_i} MB left" - customer.stanza_to(m) + ExpiringLog.new("jmp_customer_sim_warn-#{customer.customer_id}") do + m = Blather::Stanza::Message.new + m.body = "Your SIM #{iccid} only has " \ + "#{(@sim.remaining_usage_kb / 1024).to_i} MB left" + customer.stanza_to(m) + end end def call @@ -194,9 +197,11 @@ class SimAnnual include SimAction def notify - m = Blather::Stanza::Message.new - m.body = "Your SIM #{iccid} only has #{@sim.remaining_days} days left" - customer.stanza_to(m) + ExpiringLog.new("jmp_customer_sim_annual-#{customer.customer_id}") do + m = Blather::Stanza::Message.new + m.body = "Your SIM #{iccid} only has #{@sim.remaining_days} days left" + customer.stanza_to(m) + end end def annual_price