remotable 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/remotable/nosync.rb +7 -1
- data/lib/remotable/version.rb +1 -1
- data/test/nosync_test.rb +11 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22d6df302d76f75f9abe3c32936decb50fde62e5c5daafadab330c06f4c1d4d8
|
4
|
+
data.tar.gz: 78c86070eab49ff4a2f9165d25e2a7d7e029d32406efc5486e14734e67d2ef2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f59309c923c6ec21ec559852e65be75faeebd1c711eccffe09766451bb692e024b4eaa431614b27c9dc8f37c721213563951f2159030b7ce523865e26b5179
|
7
|
+
data.tar.gz: 6baecf50d8df1c784b82352aed90ec4af6bfb83b0c81e004ccd5e2309d42a0c72f3f2067c17aaf34217fd848223fc0e74f26247de4a0fa97fd5056d8949a1f18
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 0.6.4
|
4
|
+
* **Feature** Added `Remotable.unsafe_nosync!` method to set `nosync` globally using a class variable. As the method name indicates, this is not threadsafe and should only be used for testing or other situations where thread safety is not an issue.
|
5
|
+
* **Bugfix** Stopped deferring to `Thread.main` if `nosync` was unset on the current thread; while convenient for tests (see above), it ended up allowing requests to leak state if they were handled on the main thread.
|
6
|
+
|
7
|
+
|
3
8
|
### 0.6.3
|
4
9
|
* **Fix** Replaced deprecated calls to URI.escape
|
5
10
|
|
data/lib/remotable/nosync.rb
CHANGED
@@ -50,8 +50,14 @@ module Remotable
|
|
50
50
|
module ClassMethods
|
51
51
|
include InstanceMethods
|
52
52
|
|
53
|
+
def unsafe_nosync!
|
54
|
+
nosync!
|
55
|
+
@_unsafe_nosync = true
|
56
|
+
end
|
57
|
+
|
53
58
|
def reset_nosync!
|
54
59
|
self.nosync = nil
|
60
|
+
remove_instance_variable :@_unsafe_nosync if instance_variable_defined? :@_unsafe_nosync
|
55
61
|
end
|
56
62
|
|
57
63
|
def nosync=(val)
|
@@ -62,7 +68,7 @@ module Remotable
|
|
62
68
|
|
63
69
|
def _nosync
|
64
70
|
return Thread.current.thread_variable_get "remotable.nosync.#{self.object_id}" if nosync_defined_on?(Thread.current)
|
65
|
-
|
71
|
+
@_unsafe_nosync if instance_variable_defined?(:@_unsafe_nosync)
|
66
72
|
end
|
67
73
|
|
68
74
|
def _nosync=(value)
|
data/lib/remotable/version.rb
CHANGED
data/test/nosync_test.rb
CHANGED
@@ -48,11 +48,9 @@ class NoSyncTest < ActiveSupport::TestCase
|
|
48
48
|
assert_equal true, Tenant.nosync?
|
49
49
|
end
|
50
50
|
|
51
|
-
test "nosync? should defer to the main thread's value if set there but not on the current thread" do
|
51
|
+
test "nosync? should not defer to the main thread's value if set there but not on the current thread" do
|
52
52
|
Remotable.nosync!
|
53
53
|
subthread = Thread.new do
|
54
|
-
assert Remotable.nosync?
|
55
|
-
Remotable.reset_nosync!
|
56
54
|
refute Remotable.nosync?
|
57
55
|
Thread.stop
|
58
56
|
end
|
@@ -60,6 +58,16 @@ class NoSyncTest < ActiveSupport::TestCase
|
|
60
58
|
assert Remotable.nosync?
|
61
59
|
end
|
62
60
|
|
61
|
+
test "unsafe_nosync! should coerce nosync? to true across threads" do
|
62
|
+
Remotable.unsafe_nosync!
|
63
|
+
subthread = Thread.new do
|
64
|
+
assert Remotable.nosync?
|
65
|
+
Thread.stop
|
66
|
+
end
|
67
|
+
sleep 0.1 while subthread.status != "sleep"
|
68
|
+
assert Remotable.nosync?
|
69
|
+
end
|
70
|
+
|
63
71
|
|
64
72
|
|
65
73
|
# ========================================================================= #
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: remotable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Lail
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|