Skip to content

Commit

Permalink
mark clear_thread! protected and remove api client from @tenant_threa…
Browse files Browse the repository at this point in the history
…dsafe
  • Loading branch information
hasclass committed Sep 17, 2015
1 parent b7e46ca commit 126bc0a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/bigcommerce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,14 @@ def configure_threadsafe(config, &_block)

ensure
# Make sure we don't leak memory
@tenant_threadsafe.delete(tenant)
clear_thread!
end

def api
@tenant_single_thread || @tenant_threadsafe[tenant]
end

def clear_thread!
self.tenant = nil
end

def build_url(config)
return config.url if config.auth == 'legacy'

Expand All @@ -96,6 +93,11 @@ def build_client(config)
end
end

def clear_thread!
@tenant_threadsafe[tenant]
self.tenant = nil
end

def tenant
Thread.current[:bc_api_tenant]
end
Expand Down

0 comments on commit 126bc0a

Please sign in to comment.