14260: Use straight SQL DELETE instead of destroy_all
[arvados.git] / services / api / lib / sweep_trashed_objects.rb
index 162bebf5130cfa81973dc3244a06900a4d8ef6f5..bedbd68a44c8a9e988c202a21457281f680e840a 100644 (file)
@@ -50,9 +50,7 @@ module SweepTrashedObjects
         update_all('is_trashed = true')
 
       # Sweep expired tokens
-      ApiClientAuthorization.
-        where("expires_at <= statement_timestamp()").
-        destroy_all
+      ActiveRecord::Base.connection.execute("DELETE from api_client_authorizations where expires_at <= statement_timestamp()")
     end
   end