X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/949c388c5ec3bc4f8cc6b3d503c11dcd20e5bbd4..319cc7b3862ff831798f92bcb2f0c921d208147d:/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 25e776a942..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