discourse/app/models/push_subscription.rb
Sam d45682716b
FIX: automatically expire bad push channels (#13156)
Previously we would retry push notifications indefinitely for all errors
except for ExpiredSubscription

Under certain conditions other persistent errors may arise such as a persistent
rate limit.

If we track more than 3 errors in a period of time longer than a day we will
delete the subscription

Also performs a bit of internal cleanup to ensure protected methods really
are private.
2021-05-27 06:49:20 +10:00

23 lines
525 B
Ruby

# frozen_string_literal: true
class PushSubscription < ActiveRecord::Base
belongs_to :user
def parsed_data
JSON.parse(data)
end
end
# == Schema Information
#
# Table name: push_subscriptions
#
# id :bigint not null, primary key
# user_id :integer not null
# data :string not null
# created_at :datetime not null
# updated_at :datetime not null
# error_count :integer default(0), not null
# first_error_at :datetime
#