X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bfa9ee952c1ae3f03fe2f9fa781a132411963030..facb17a2885e6b6d3e998e15862a3c6e970e8cf1:/apps/workbench/app/models/arvados_api_client.rb diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb index 9a2b0ce243..a7ae8ba3aa 100644 --- a/apps/workbench/app/models/arvados_api_client.rb +++ b/apps/workbench/app/models/arvados_api_client.rb @@ -13,7 +13,14 @@ class ArvadosApiClient # An API client object suitable for handling API requests on behalf # of the current thread. def self.new_or_current - Thread.current[:arvados_api_client] ||= new + # If this thread doesn't have an API client yet, *or* this model + # has been reloaded since the existing client was created, create + # a new client. Otherwise, keep using the latest client created in + # the current thread. + unless Thread.current[:arvados_api_client].andand.class == self + Thread.current[:arvados_api_client] = new + end + Thread.current[:arvados_api_client] end def initialize *args @@ -67,9 +74,9 @@ class ArvadosApiClient header = {"Accept" => "application/json"} - profile_checkpoint { "Prepare request #{url} #{query[:uuid]} #{query[:where]}" } + profile_checkpoint { "Prepare request #{url} #{query[:uuid]} #{query[:where]} #{query[:filters]}" } msg = @client_mtx.synchronize do - @api_client.post(url, + @api_client.post(url, query, header: header) end