X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1e6a756a10a1c0a77aeea5041844ba3a572bdd70..7cf18615c7104bb59f1be54ca35e99f7ee7c5f27:/services/api/lib/sweep_trashed_collections.rb diff --git a/services/api/lib/sweep_trashed_collections.rb b/services/api/lib/sweep_trashed_collections.rb index 01b63fdb82..a899191db0 100644 --- a/services/api/lib/sweep_trashed_collections.rb +++ b/services/api/lib/sweep_trashed_collections.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'current_api_client' module SweepTrashedCollections @@ -5,10 +9,10 @@ module SweepTrashedCollections def self.sweep_now act_as_system_user do - Collection.unscoped. + Collection. where('delete_at is not null and delete_at < statement_timestamp()'). destroy_all - Collection.unscoped. + Collection. where('is_trashed = false and trash_at < statement_timestamp()'). update_all('is_trashed = true') end