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.
This commit is contained in:
Sam
2021-05-27 06:49:20 +10:00
committed by GitHub
parent b9053c5e77
commit d45682716b
4 changed files with 119 additions and 26 deletions

View File

@@ -2,15 +2,21 @@
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
# 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
#