acts_as_tenant 2.2.2 → 2.3.0
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6485bd20f8b55c9024d1c87fcca75d3d66971467af8afb01f6c9af36120576b9
|
|
4
|
+
data.tar.gz: 3842ca6d1d06dc012be3885202bfac86a9c35c72f7e91e0603e6894c3bfe80ff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6d31a3001c35da9b313d0133e6893a7bb3462d96320f93097fdb685b403d59f9d5449ecb17e6a0d7cdcedbebe0524aa3bc7cd45fd308ee2d8f11ace499593e5
|
|
7
|
+
data.tar.gz: fa936cf5f55253412a3f8c43104bca9f4fce421d18fc525dfb63d1196c6d961f258832f324aff7585967dd9cfa326428ba361f053acab4bf1b82747ab76cc4ca
|
|
@@ -34,8 +34,16 @@ module ActsAsTenant
|
|
|
34
34
|
def deserialize_arguments_if_needed
|
|
35
35
|
return super unless @acts_as_tenant_global_id
|
|
36
36
|
|
|
37
|
-
@acts_as_tenant_job_tenant =
|
|
37
|
+
@acts_as_tenant_job_tenant = locate_tenant
|
|
38
38
|
ActsAsTenant.with_tenant(@acts_as_tenant_job_tenant) { super }
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
# Raise for a deleted tenant as Rails does for a deleted argument. The error's cause is the
|
|
42
|
+
# ActiveRecord::RecordNotFound, so `discard_on ActiveRecord::RecordNotFound` still matches.
|
|
43
|
+
def locate_tenant
|
|
44
|
+
GlobalID::Locator.locate(@acts_as_tenant_global_id)
|
|
45
|
+
rescue ActiveRecord::RecordNotFound
|
|
46
|
+
raise ActiveJob::DeserializationError
|
|
47
|
+
end
|
|
40
48
|
end
|
|
41
49
|
end
|
|
@@ -23,7 +23,10 @@ module ActsAsTenant::Sidekiq
|
|
|
23
23
|
include Sidekiq::ServerMiddleware if sidekiq_7_and_up?
|
|
24
24
|
|
|
25
25
|
def call(worker_class, msg, queue)
|
|
26
|
-
|
|
26
|
+
# An ActiveJob job carries its own tenant and sets it while it performs (see
|
|
27
|
+
# ActsAsTenant::ActiveJobExtensions), where `discard_on` can handle a tenant that no
|
|
28
|
+
# longer exists. Looking it up here would raise before the job could.
|
|
29
|
+
if msg.has_key?("acts_as_tenant") && !msg.has_key?("wrapped")
|
|
27
30
|
klass = msg["acts_as_tenant"]["class"].constantize
|
|
28
31
|
id = msg["acts_as_tenant"]["id"]
|
|
29
32
|
account = klass.class_eval(&ActsAsTenant.configuration.job_scope).find(id)
|