zoidberg 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/zoidberg/pool.rb +6 -0
- data/lib/zoidberg/proxy/liberated.rb +9 -0
- data/lib/zoidberg/shell.rb +4 -2
- data/lib/zoidberg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32acff92e97fb082892e250a4e672adf569a2648
|
4
|
+
data.tar.gz: bda6511a8e52e778d0aefc0b7ca3485321cd5aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07941b9b12c199d8d0ecd87992ccefd1bbf2794006e2b1d980306b683f260b362c6d9e9359ea6da68bdbb94aef9580ed76725429b65192ea2610d591669def79
|
7
|
+
data.tar.gz: 949f2f5f6e5886da400828ca3b1eef2f4c556f6d0e748e6dc6fa77a0a0a2c6111260c67b6fcf7c7f7a57675ac52d145eeb7fd456fbb3512212c216f770ad8259
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# v0.2.2
|
2
|
+
* Remove async threads once they have reached completion
|
3
|
+
* Attempt to locate free worker in pool for async, random pick if none
|
4
|
+
|
1
5
|
# v0.2.0
|
2
6
|
* Update termination behaviors to ensure expected results
|
3
7
|
* Provide and use flag for system shutdown to disable supervision
|
data/lib/zoidberg/pool.rb
CHANGED
@@ -75,6 +75,12 @@ module Zoidberg
|
|
75
75
|
true
|
76
76
|
end
|
77
77
|
|
78
|
+
# Proxy async to prevent synchronized access
|
79
|
+
def async(*args,&block)
|
80
|
+
worker = _workers.detect(&:_zoidberg_available?) || _workers.sample
|
81
|
+
worker.send(:async, *args, &block)
|
82
|
+
end
|
83
|
+
|
78
84
|
# Used to proxy request to worker
|
79
85
|
def method_missing(*args, &block)
|
80
86
|
worker = _zoidberg_free_worker
|
@@ -95,6 +95,15 @@ module Zoidberg
|
|
95
95
|
true
|
96
96
|
end
|
97
97
|
|
98
|
+
# Deregister a thread once it has completed
|
99
|
+
#
|
100
|
+
# @param thread [Thread]
|
101
|
+
# @return [TrueClass]
|
102
|
+
def _zoidberg_unthread(thread)
|
103
|
+
_raw_threads.delete(thread)
|
104
|
+
true
|
105
|
+
end
|
106
|
+
|
98
107
|
# Aquire the lock to access real instance. If already locked, will
|
99
108
|
# wait until lock can be aquired.
|
100
109
|
#
|
data/lib/zoidberg/shell.rb
CHANGED
@@ -39,9 +39,10 @@ module Zoidberg
|
|
39
39
|
def method_missing(*args, &block)
|
40
40
|
target._zoidberg_thread(
|
41
41
|
Thread.new{
|
42
|
-
|
43
|
-
got_lock = locked
|
42
|
+
got_lock = false
|
44
43
|
begin
|
44
|
+
origin_proxy._aquire_lock! if locked
|
45
|
+
got_lock = locked
|
45
46
|
target.send(*args, &block)
|
46
47
|
rescue Zoidberg::DeadException => e
|
47
48
|
if(e.origin_object_id == target.object_id)
|
@@ -53,6 +54,7 @@ module Zoidberg
|
|
53
54
|
raise
|
54
55
|
ensure
|
55
56
|
origin_proxy._release_lock! if got_lock
|
57
|
+
origin_proxy._zoidberg_unthread(Thread.current)
|
56
58
|
end
|
57
59
|
}
|
58
60
|
)
|
data/lib/zoidberg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoidberg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo
|