panda_pal 5.16.3 → 5.16.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2c0409f3edd41806fcd606b52eb0c6441c43dac7b9e1eeb89c1871b6e08525f
4
- data.tar.gz: 14b3313348391ab1c364ee9bb404af319bf93b831fc5bd552059faf41a179b71
3
+ metadata.gz: 31f691e98fe16d192785ff162ece3e7b7dc4964a89db280769d3f1197a1ba94e
4
+ data.tar.gz: 67262506ba9efad1143e38570d56418d2ac3a5c44d6daa3f0ea8ecd0cc54ce3b
5
5
  SHA512:
6
- metadata.gz: e2c460dd7ac5ff05da55ef6db233f0d266983927e6a295b469d1d19002ea833b26479c5b7db53fb6306761afc683bf3494fc07c63f1ac401f736d73ad803248b
7
- data.tar.gz: bcccc2e5ad50d546f3258e513118e97a37f8104901436b3b3920d64986ad83159034a905cce7ded7b81529989d16d8151f0583ec7b273732e2d38be443a6dc8e
6
+ metadata.gz: 119ab51e712dd115adaa63f6ffe19985d74f73bfa2c4a3e0663fec31689839e35db2c4a0995ce68581077d251b94082e2e182fb62aa94129dac41ca7981b07c3
7
+ data.tar.gz: cb0cd5101c6a1123b027ee494d9a2044d54c3280baba134d5066cd5dfcb1309dafa4b25c0a3f69215274b0350e309e7e1fc6c1aa81248b4c844c5a29eb1142ff
@@ -287,32 +287,32 @@ ActiveSupport.on_load(:action_cable) do
287
287
  # at which time we hack-in the correct tenant/schema.
288
288
 
289
289
  ActionCable::Server::Worker.set_callback :work, :around do |_, blk|
290
- # Bit of a hack, but ensures the adapter is initialized (since such may incur DB calls (requiring a connection)
291
- # which would then cause `checkout` to recurse)
292
- Apartment::Tenant.adapter
290
+ # Bit of a hack, but placing this here ensures the adapter is initialized (since such may incur DB calls (requiring a connection)
291
+ # which could then cause `checkout` to recurse)
292
+ Thread.current[:cable_tenant] = {
293
+ adapter: Apartment::Tenant.adapter,
294
+ tenant: connection.tenant,
295
+ }
293
296
 
294
297
  # If the current thread already has a connection checked out, release it back to the pool so that the later after_checkout
295
298
  # callback can set the schema properly.
296
299
  pool = Apartment.connection_class.connection_pool
297
300
  pool.release_connection if pool.active_connection?
298
301
 
299
- Thread.current[:cable_tenant] = connection.tenant
300
302
  blk.call
301
303
  ensure
302
304
  Thread.current[:cable_tenant] = nil
303
305
  end
304
306
 
305
307
  ActiveSupport.on_load(:active_record) do
306
- if Apartment::Tenant.adapter.is_a?(Apartment::Adapters::PostgresqlSchemaAdapter)
307
- ActiveRecord::Base.connection.class.set_callback :checkout, :after do |conn|
308
- next unless conn.pool == Apartment.connection_class.connection_pool
309
-
310
- if (ct = Thread.current[:cable_tenant]).present?
311
- adapter = Apartment::Tenant.adapter
312
- adapter.instance_variable_set(:@current, ct)
313
- conn.schema_search_path = adapter.send :full_search_path
314
- end
315
- end
308
+ ActiveRecord::Base.connection.class.set_callback :checkout, :after do |conn|
309
+ next unless (ct = Thread.current[:cable_tenant]).present?
310
+ next unless Apartment::Tenant.adapter.is_a?(Apartment::Adapters::PostgresqlSchemaAdapter)
311
+ next unless conn.pool == Apartment.connection_class.connection_pool
312
+
313
+ adapter = ct[:adapter]
314
+ adapter.instance_variable_set(:@current, ct[:tenant])
315
+ conn.schema_search_path = adapter.send :full_search_path
316
316
  end
317
317
  end
318
318
  end
@@ -1,3 +1,3 @@
1
1
  module PandaPal
2
- VERSION = "5.16.3"
2
+ VERSION = "5.16.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panda_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.16.3
4
+ version: 5.16.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Instructure CustomDev