remotable 0.6.0 → 0.6.1

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: c5772a5edc3139fabf4602d96c59fc69fe3ac83ae016d286a2257deac26ae8e0
4
- data.tar.gz: e0e6a52da707287733bcc0bb22a4d34e515bec9e2e869f0a2ac4f49696e07b19
3
+ metadata.gz: a78225c824ca7d175cf92ee2b9249c8f7cb564b40b9cb9e517afb23c60942a33
4
+ data.tar.gz: c9ccfb561fcf0589e907868f62bc0208677addd29be93bf69556d84e0a1e7997
5
5
  SHA512:
6
- metadata.gz: ec594e5275ecb8a7dbd7df17f5c1addfc16f3b982391d8bb88079dc3922f3d62549ef4422bad8d9c9113d7528077490947d3999ca02d32cc2d12a262acad8980
7
- data.tar.gz: 5d4c975e43ab1e62af43e257eacd0d5f28a32729ed31de556ef8bf950890db1bf7117d06c0d669cb9ceb8a189f24e77fafda0dd177ff643a41fef4b2615d6117
6
+ metadata.gz: f59286e3951a20031978f3077f95a3d93fb9d4a69cbeb37d35ae7375233b10ddf9ed28f09c7a4d95aa8a2c38bc10b942b6f48f6a451a4a3c1222262f44d976c6
7
+ data.tar.gz: 114ee2c2f19c42c85b81e629a540aa8bfee1cc7b269462e62743e41ed09273627cdc2f21a8532a8d4f9cf681cc6bb9e74f9f46ebc91404c78aa67b181a8fc1d2
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ### 0.6.1
4
+ * **Bugfix** Tweaked the behavior of `Remotable.nosync?` to defer to a value set on the main thread if no value has been set for the current thread.
5
+
3
6
  ### 0.6.0
4
7
  * **Bugfix** Completely removed dependence on `activeresource`'s `ThreadsafeAttributes`. This makes multithreaded behavior more deterministic and involves fewer edgecases, since things meant to be global state are reverted back to being so, while things meant to have a per-thread scope are constrained as they should be.
5
8
 
@@ -61,11 +61,17 @@ module Remotable
61
61
  private
62
62
 
63
63
  def _nosync
64
- Thread.current.thread_variable_get "remotable.nosync.#{self.object_id}"
64
+ return Thread.current.thread_variable_get "remotable.nosync.#{self.object_id}" if nosync_defined_on?(Thread.current)
65
+ return Thread.main.thread_variable_get "remotable.nosync.#{self.object_id}" if nosync_defined_on?(Thread.main)
65
66
  end
66
67
 
67
68
  def _nosync=(value)
68
69
  Thread.current.thread_variable_set "remotable.nosync.#{self.object_id}", value
70
+ Thread.current.thread_variable_set "remotable.nosync.#{self.object_id}.defined", true
71
+ end
72
+
73
+ def nosync_defined_on?(thread)
74
+ !!thread.thread_variable_get("remotable.nosync.#{self.object_id}.defined")
69
75
  end
70
76
 
71
77
  end
@@ -1,3 +1,3 @@
1
1
  module Remotable
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -48,6 +48,18 @@ 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
52
+ Remotable.nosync!
53
+ subthread = Thread.new do
54
+ assert Remotable.nosync?
55
+ Remotable.reset_nosync!
56
+ refute Remotable.nosync?
57
+ Thread.stop
58
+ end
59
+ sleep 0.1 while subthread.status != "sleep"
60
+ assert Remotable.nosync?
61
+ end
62
+
51
63
 
52
64
 
53
65
  # ========================================================================= #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remotable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Lail