CWL spec -> CWL standards
[arvados.git] / services / api / lib / refresh_permission_view.rb
index cfd7b6ae59ce00239450f8014671de3bccce9c90..5d6081f262b25756dd7e3fcdeec42ae762c4687f 100644 (file)
@@ -12,14 +12,19 @@ def do_refresh_permission_view
 end
 
 def refresh_permission_view(async=false)
-  if async and Rails.configuration.async_permissions_update_interval > 0
-    exp = Rails.configuration.async_permissions_update_interval.seconds
+  if async and Rails.configuration.API.AsyncPermissionsUpdateInterval > 0
+    exp = Rails.configuration.API.AsyncPermissionsUpdateInterval.seconds
+    need = false
     Rails.cache.fetch('AsyncRefreshPermissionView', expires_in: exp) do
+      need = true
+    end
+    if need
       # Schedule a new permission update and return immediately
       Thread.new do
         Thread.current.abort_on_exception = false
         begin
           sleep(exp)
+          Rails.cache.delete('AsyncRefreshPermissionView')
           do_refresh_permission_view
         rescue => e
           Rails.logger.error "Updating permission view: #{e}\n#{e.backtrace.join("\n\t")}"