14260: Use straight SQL DELETE instead of destroy_all
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 19 Oct 2018 14:06:50 +0000 (10:06 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Fri, 19 Oct 2018 14:06:50 +0000 (10:06 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

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