app/models/device.rb
# Sets the `throttled_until` and `throttled_at` fields if unpopulated or
# the throttle time period increases. Notifies user of cooldown period.
Sets the `throttled_until` and `throttled_at` fields if unpopulated or
the throttle time period increases. Notifies user of cooldown period.
Sets the ` throttled_until ` and ` throttled_at ` fields if unpopulated or the throttle time period increases . Notifies user of cooldown period .
def maybe_throttle(violation)
    end_t = violation.ends_at
    if (throttled_until.nil? || (end_t > throttled_until))
      auto_sync_transaction do
        reload.update!(throttled_until: end_t, throttled_at: Time.now)
      end
      cooldown = end_t.in_time_zone(self.timezone || "UTC").strftime("%I:%M%p")
      info = [violation.explanation, cooldown]
      cooldown_notice(THROTTLE_ON % info, end_t, "warn")
    end
  end
def maybe_throttle ( violation ) end_t = violation . ends_at if ( throttled_until . nil? || ( end_t > throttled_until ) ) auto_sync_transaction do reload . update! ( throttled_until : end_t , throttled_at : Time . now ) end cooldown = end_t . in_time_zone ( self . timezone || "UTC" ) . strftime ( "%I:%M%p" ) info = [ violation . explanation , cooldown ] cooldown_notice ( THROTTLE_ON % info , end_t , "warn" ) end end
Sets the `throttled_until` and `throttled_at` fields if unpopulated or
the throttle time period increases.
Sets the ` throttled_until ` and ` throttled_at ` fields if unpopulated or the throttle time period increases .
# Some log validation errors will result in until_time being `nil`.
violation
<not_specific>