X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/001a60dff02545c2d2476a437b1846c9ae633941..3d878236c48e4856b5f58fdc2e6d35f8193e6150:/services/api/lib/sweep_trashed_objects.rb diff --git a/services/api/lib/sweep_trashed_objects.rb b/services/api/lib/sweep_trashed_objects.rb index 59008c0fc3..8613c749cf 100644 --- a/services/api/lib/sweep_trashed_objects.rb +++ b/services/api/lib/sweep_trashed_objects.rb @@ -48,12 +48,15 @@ module SweepTrashedObjects where({group_class: 'project'}). where('is_trashed = false and trash_at < statement_timestamp()'). update_all('is_trashed = true') + + # Sweep expired tokens + ActiveRecord::Base.connection.execute("DELETE from api_client_authorizations where expires_at <= statement_timestamp()") end end def self.sweep_if_stale - return if Rails.configuration.trash_sweep_interval <= 0 - exp = Rails.configuration.trash_sweep_interval.seconds + return if Rails.configuration.Collections.TrashSweepInterval <= 0 + exp = Rails.configuration.Collections.TrashSweepInterval.seconds need = false Rails.cache.fetch('SweepTrashedObjects', expires_in: exp) do need = true