riser 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/riser/resource.rb +2 -2
- data/lib/riser/server.rb +14 -17
- data/lib/riser/version.rb +1 -1
- 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: cde718ab160b32665cc369a9802ede8b4001443dd53ca1c41cce55b09895a048
|
4
|
+
data.tar.gz: 11f103a7d7260481c059098c2859e267c8b870aed23e599ad1a5045a5a038530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c36db5ee689500348d5e53815917e9ee841b80abe4d50432699446ea21c7b928bbb3cf8a6e74705dc299cd0424c63dfd5c574b41053d1b8cc140fcd83b9ffea2
|
7
|
+
data.tar.gz: 4e46ece94c0dc1c8fe64ba0538803f8a504fd6d69348e68f2324dedc743c30e4842420596fb7fcdb711e0ec343efbda99766b8805039432628f931e41a8bfe23
|
data/lib/riser/resource.rb
CHANGED
@@ -23,7 +23,7 @@ module Riser
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def proxy_count
|
26
|
-
@mutex.synchronize{ @ref_proxy.
|
26
|
+
@mutex.synchronize{ @ref_proxy.size }
|
27
27
|
end
|
28
28
|
|
29
29
|
def ref_object?
|
@@ -227,7 +227,7 @@ module Riser
|
|
227
227
|
end
|
228
228
|
|
229
229
|
def proxy_count
|
230
|
-
@mutex.synchronize{ @ref_proxy.
|
230
|
+
@mutex.synchronize{ @ref_proxy.size }
|
231
231
|
end
|
232
232
|
|
233
233
|
def ref_object?(access_key)
|
data/lib/riser/server.rb
CHANGED
@@ -6,8 +6,8 @@ require 'tempfile'
|
|
6
6
|
|
7
7
|
module Riser
|
8
8
|
class TimeoutSizedQueue
|
9
|
-
def initialize(
|
10
|
-
@
|
9
|
+
def initialize(max_size, name: nil)
|
10
|
+
@max_size = max_size
|
11
11
|
@queue = []
|
12
12
|
@closed = false
|
13
13
|
@mutex = Thread::Mutex.new
|
@@ -50,15 +50,15 @@ module Riser
|
|
50
50
|
@stat_push_count += 1
|
51
51
|
@stat_push_average_queue_size = (@stat_push_average_queue_size * (@stat_push_count - 1) + @queue.size) / @stat_push_count
|
52
52
|
end
|
53
|
-
unless (@queue.size < @
|
53
|
+
unless (@queue.size < @max_size) then
|
54
54
|
@stat_push_wait_count += 1 if @stat_enable
|
55
55
|
@push_cond.wait(@mutex, timeout_seconds)
|
56
|
-
unless (@queue.size < @
|
56
|
+
unless (@queue.size < @max_size) then
|
57
57
|
@stat_push_timeout_count += 1 if @stat_enable
|
58
58
|
return
|
59
59
|
end
|
60
60
|
end
|
61
|
-
@pop_cond.signal
|
61
|
+
@pop_cond.signal if @queue.empty?
|
62
62
|
@queue.push(value)
|
63
63
|
self
|
64
64
|
}
|
@@ -75,7 +75,7 @@ module Riser
|
|
75
75
|
@stat_pop_wait_count += 1 if @stat_enable
|
76
76
|
@pop_cond.wait(@mutex)
|
77
77
|
end
|
78
|
-
@push_cond.signal
|
78
|
+
@push_cond.signal if (@queue.size == @max_size)
|
79
79
|
@queue.shift
|
80
80
|
}
|
81
81
|
end
|
@@ -115,7 +115,7 @@ module Riser
|
|
115
115
|
@mutex.synchronize{
|
116
116
|
info = {
|
117
117
|
queue_name: @name,
|
118
|
-
|
118
|
+
max_size: @max_size,
|
119
119
|
closed: @closed,
|
120
120
|
start_time: @stat_start_time,
|
121
121
|
push_average_queue_size: @stat_push_average_queue_size,
|
@@ -140,7 +140,7 @@ module Riser
|
|
140
140
|
|
141
141
|
# sort
|
142
142
|
[ :queue_name,
|
143
|
-
:
|
143
|
+
:max_size,
|
144
144
|
:closed,
|
145
145
|
:start_time,
|
146
146
|
:get_time,
|
@@ -503,10 +503,10 @@ module Riser
|
|
503
503
|
nil
|
504
504
|
end
|
505
505
|
|
506
|
-
SEND_CMD = "SEND\n".freeze
|
507
|
-
SEND_LEN = SEND_CMD.
|
508
|
-
RADY_CMD = "RADY\n".freeze
|
509
|
-
RADY_LEN = RADY_CMD.
|
506
|
+
SEND_CMD = "SEND\n".freeze # :nodoc:
|
507
|
+
SEND_LEN = SEND_CMD.bytesize # :nodoc:
|
508
|
+
RADY_CMD = "RADY\n".freeze # :nodoc:
|
509
|
+
RADY_LEN = RADY_CMD.bytesize # :nodoc:
|
510
510
|
|
511
511
|
def start(server_socket)
|
512
512
|
case (server_socket)
|
@@ -525,8 +525,8 @@ module Riser
|
|
525
525
|
@process_num.times do |pos|
|
526
526
|
child_io, parent_io = UNIXSocket.socketpair
|
527
527
|
pid = Process.fork{
|
528
|
+
server_socket.close
|
528
529
|
parent_latch_file.close
|
529
|
-
|
530
530
|
parent_io.close
|
531
531
|
pos.times do |i|
|
532
532
|
process_list[i].io.close
|
@@ -748,10 +748,7 @@ module Riser
|
|
748
748
|
@dispatcher.thread_queue_size = @thread_queue_size
|
749
749
|
@dispatcher.thread_queue_polling_timeout_seconds = @thread_queue_polling_timeout_seconds
|
750
750
|
|
751
|
-
@dispatcher.at_fork
|
752
|
-
server_socket.close
|
753
|
-
@at_fork.call
|
754
|
-
}
|
751
|
+
@dispatcher.at_fork(&@at_fork)
|
755
752
|
@dispatcher.at_stop(&@at_stop)
|
756
753
|
@dispatcher.at_stat(&@at_stat)
|
757
754
|
@dispatcher.preprocess(&@preprocess)
|
data/lib/riser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TOKI Yoshinori
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|