oni 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e86f0fc6b0d6056128511d7a55a0d6be22b4830a
4
- data.tar.gz: 67bb84f5831cfcaa771103bfa81e5bc96c052054
3
+ metadata.gz: 4b4738a5669401fa905d283e4edd281aa7887747
4
+ data.tar.gz: 0b961cee5c6dfb02026cf774ed36a1e787923a59
5
5
  SHA512:
6
- metadata.gz: 3da0297aec49385fe97d280906ef75dc89f24e0c571baab7ebc3dde484e13ea31e47f0b7dd80928dfd5da8b0d4adab10d3a8aa33b30daa63e5872f38dfac6b7c
7
- data.tar.gz: ca0126f07de0d95b51e5abc149435450c573672352b7525b2acabbba010d812fa17e83736828bf98706515d40b568e21b1c5c66d4e908425c77a23203214199a
6
+ metadata.gz: fd755fdced951be0b3f71fee761f720de550533939d83e5c02e39b7b29c01f8b49ad1d340c3c13a5369c36b74780c63f1578726713a38a5f9f675c3177d4a540
7
+ data.tar.gz: 5e6330b01276fbf0efe9dda7f97e54dd7fe6819250e2caa889ff7a8c735b0944c2af0a1d9a00a2e74c2c66f49bc9674e5675c85472cb02ccc13847ca179725a7
data/doc/changelog.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # @title Changelog
2
2
  # Changelog
3
3
 
4
+ ## 4.0.0 - April 24th, 2015
5
+
6
+ Oni now depends on V2 of the AWS SDK and no longer sends any benchmarking
7
+ details to `Daemon#complete`.
8
+
4
9
  ## 3.1.1 - February 20th, 2015
5
10
 
6
11
  Oni now depends on version 1 of the AWS SDK (`aws-sdk-v1`) due to the `aws-sdk`
data/lib/oni/daemon.rb CHANGED
@@ -22,6 +22,13 @@ module Oni
22
22
  #
23
23
  DEFAULT_THREAD_AMOUNT = 5
24
24
 
25
+ ##
26
+ # The default amount of threads to start.
27
+ #
28
+ # @return [Fixnum]
29
+ #
30
+ DEFAULT_WORKER_TIMEOUT = nil
31
+
25
32
  ##
26
33
  # Creates a new instance of the class and calls `#after_initialize` if it
27
34
  # is defined.
@@ -42,13 +49,14 @@ module Oni
42
49
  def start
43
50
  before_start if respond_to?(:before_start)
44
51
 
45
- # If we don't have any threads run in non threaded mode.
46
52
  if threads > 0
47
53
  threads.times do
48
54
  workers << spawn_thread
49
55
  end
50
56
 
51
57
  workers.each(&:join)
58
+
59
+ # If we don't have any threads run in non threaded mode.
52
60
  else
53
61
  run_thread
54
62
  end
@@ -75,6 +83,15 @@ module Oni
75
83
  return option(:threads, DEFAULT_THREAD_AMOUNT)
76
84
  end
77
85
 
86
+ ##
87
+ # Returns the amount of threads to use.
88
+ #
89
+ # @return [Fixnum]
90
+ #
91
+ def worker_timeout
92
+ option :worker_timeout, DEFAULT_WORKER_TIMEOUT
93
+ end
94
+
78
95
  ##
79
96
  # Processes the given message. Upon completion the `#complete` method is
80
97
  # called and passed the resulting output.
@@ -98,9 +115,11 @@ module Oni
98
115
  mapper = create_mapper
99
116
  input = mapper.map_input(message)
100
117
  worker = option(:worker).new(*input)
101
- output = worker.process
118
+ output = Timeout.timeout worker_timeout do
119
+ worker.process
120
+ end
102
121
 
103
- return mapper.map_output(output)
122
+ mapper.map_output output
104
123
  end
105
124
 
106
125
  ##
@@ -171,7 +190,9 @@ module Oni
171
190
  # (and fail hard) or if it should continue running.
172
191
  #
173
192
  def run_thread
174
- receive { |message| process(message) }
193
+ receive do |message|
194
+ process message
195
+ end
175
196
  rescue => error
176
197
  error(error)
177
198
 
data/lib/oni/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oni
2
- VERSION = '4.0.0'
2
+ VERSION = '4.1.0'
3
3
  end # Oni
data/lib/oni.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'thread'
2
+ require 'timeout'
2
3
 
3
4
  require_relative 'oni/version'
4
5
  require_relative 'oni/configurable'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oni
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yorick Peterse
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-24 00:00:00.000000000 Z
12
+ date: 2017-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -149,9 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.4.5
152
+ rubygems_version: 2.6.13
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Framework for building concurrent daemons in Ruby.
156
156
  test_files: []
157
- has_rdoc: yard