Memo - Activation/Suspension Cycle - August 31st 2023

Nicolas Audet
Nicolas Audet
  • Updated
(changes of August 31st 2023)
The big upgrade we’re making:
  • The cron job will run each hour of the day
  • The cron job will make sure to record usage properly:
  • Won’t create usage when the last usage has been recorded less than 24 hours ago
  • Won’t create usage when the billing threshold has been recovered less then 24 hours ago (for example, if we receive a payment and we reactivate someone, we wait 24 hours before creating the usage record)
  • Usage records will continue to be recorded at the same time regardless of when the threshold is updated if the threshold has never been reached (In non-billing words, that means:
  • On August 1st 7:00 AM, an account pays for 2 days
  • On August 2nd 7:00 AM, we record a day of usage
  • On August 2nd 10:00 AM, the account pays for another 2 days. It brings its balance to 4 days
  • On August 3rd 7:00 AM, we record the 2nd day of usage <--- (see that we still keep the initial moment of the first record (7:00 AM))
  • On August 4th 7:00 AM, we record the 3rd day of usage
  • On August 5th 7:00 AM, we record the 4th day of usage, the threshold is reached, we emit the event and the client gets suspended
By running this on an hourly basis instead of once per day, we remove all edge cases where we would give more hours/more days of free internet to customers.
For example,
  • What we currently have
  • Day 1, 5h00, Customer pays for 2 days. Balance goes from  0 --> 2
  • Day 2, 1h24, Cron runs, no usage record taken (because it’s not been 24 hours)
  • Day 3, 1h24, Cron runs, usage record taken
  • Day 4, 1h24, Cron runs, usage record taken, emit threshold exceeded. The client gets suspended
  • Day 4,  13h00, Customer pays for another 2 days. The balance goes from 2 --> 4
  • Day 5,  1h24, Cron runs, no usage record taken (not 24 hours since last payment)
  • Day 6, 1h24, Cron runs, usage record taken
  • Day 7, 1h24, Cron runs, usage record taken, emit threshold exceeded, client gets suspended
  • Total usage:  2 days, 20 hours, 24 minutes + 2 days, 12 hours, 24 minutes = 5 days, 12 hours, 48 minutes
  • What the new solution will bring:
  • Day 1, 5h00, Customer pays for 2 days. Balance goes from  0 --> 2
  • Day 2, ~5h00, Cron runs, usage record taken
  • Day 3, ~5h00, Cron runs, usage record taken, emit threshold exceeded. The client gets suspended
  • Day 4, 13h00,  Customer pays for another 2 days. The balance goes from 2 --> 4
  • Day 5, ~13h00, Cron runs, usage record taken
  • Day 6, ~13h00, Cron runs, usage record taken, emit threshold exceeded, the client get suspended
  • Total usage: 4 days
As you can understand, the hour in the day at which the customers pay to get their first days of service matters whereas before, you would get more “free internet” depending on when you bought your days.

Was this article helpful?

Have more questions? Submit a request