Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodically remove expired PuSH subscribers #4654

Merged
merged 1 commit into from
Aug 21, 2017

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Aug 21, 2017

No description provided.

@@ -26,6 +26,7 @@ class Subscription < ApplicationRecord

scope :confirmed, -> { where(confirmed: true) }
scope :future_expiration, -> { where(arel_table[:expires_at].gt(Time.now.utc)) }
scope :expired, -> { where(arel_table[:expires_at].lt(Time.now.utc)) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing it immediately seems maybe bad depending on when people set their renewal times to be? Something like expires_at.lt(Time.now.utc - 7.days) or 14 days is probably Good Enough and allows for a little bit of leniency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nightpool This matters not. Renewing is the same as subscribing from scratch. The secret is fresh, etc. There is virtually no reason why you'd want to keep a particular record beyond its expiration date. Plus the removal worker runs only once a day.

Copy link
Member

@nightpool nightpool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, LGTM then

@Gargron Gargron merged commit f391a46 into master Aug 21, 2017
@Gargron Gargron deleted the fix-clean-expired-subscribers branch August 21, 2017 20:56
abcang pushed a commit to pixiv/mastodon that referenced this pull request Aug 22, 2017
lindwurm pushed a commit to akane-blue/mastodon that referenced this pull request Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants