From 9dafe902e62b2006e4e1c27a37355f8b2f16a1af Mon Sep 17 00:00:00 2001 From: Pavel Shebalkou Date: Sat, 10 Feb 2024 15:35:27 +0300 Subject: [PATCH 1/2] Consider expires_in when clear expired tokens with StaleRecordsCleaner --- lib/doorkeeper/orm/active_record/stale_records_cleaner.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb b/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb index 3ba6bd590..275e0bc16 100644 --- a/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb +++ b/lib/doorkeeper/orm/active_record/stale_records_cleaner.rb @@ -28,6 +28,7 @@ def clean_expired(ttl) @base_scope .where.not(expires_in: nil) .where(table[:created_at].lt(Time.current - ttl)) + .where(table[:created_at] + table[:expires_in].lt(Time.current)) .in_batches(&:delete_all) end end From 99f80682e51f8fa4bd6f808a046ba8ff7def0ee1 Mon Sep 17 00:00:00 2001 From: Pavel Shebalkou Date: Sat, 10 Feb 2024 15:40:57 +0300 Subject: [PATCH 2/2] add pr to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a0c5e40a..f8d52e9f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,8 @@ User-visible changes worth mentioning. ## main -Add your entry here. +- [#1690] Consider expires_in when clear expired tokens with StaleRecordsCleaner. - [#1747] Fix unknown pkce method error when configured ## 5.8.0