celluloid 0.15.0 → 0.15.1

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: e245e48da91f90663b7d0ebc235c09e31ab2c4c8
4
- data.tar.gz: 90be7b8790c63dfa656e9ddba3e7c97118b9c27c
3
+ metadata.gz: 2d074071245d3218d8e119b0bf9f12f05aab6c8f
4
+ data.tar.gz: 5b7fb44228ae18ed9d1d64f9a26ae82bc61acf6f
5
5
  SHA512:
6
- metadata.gz: ab5dcbccea33be7e208ec0b83195351843760f45caf65f8b5505239f1822a9042f46c5071fbfd55eba8c0c8e6f01fb35b4849a7d539e9763f542bef2153c478d
7
- data.tar.gz: f0d86887d99804ace8cb1e14e3b0c0285f4e31d56b1bcad73ebd68e1ac5a8d9c2420560b9ac62a5f15761b21faefc62dc4b94d3ac0293534bf0b089ae162ab37
6
+ metadata.gz: 2a006db60f84694c38e5ff90585c5890b1eed7b5b517f302d3d6e9a50552e6c5c44df07d50dce9bc6a2d87d7f91470c7d9a617d427e3f4e28426ecbb4affe3c6
7
+ data.tar.gz: 1969c4c6ba4fc4bdedc606b5009d5ab0aacf73d76a48c905a523f2774ca75696eb5e81b338702f07aa8da7c16bff6e5d6f1cb72ce77957258411d4cf0c94c3af
@@ -8,7 +8,7 @@ if defined?(JRUBY_VERSION) && JRUBY_VERSION == "1.7.3"
8
8
  end
9
9
 
10
10
  module Celluloid
11
- VERSION = '0.15.0'
11
+ VERSION = '0.15.1'
12
12
  Error = Class.new StandardError
13
13
 
14
14
  extend self # expose all instance methods as singleton methods
@@ -91,6 +91,7 @@ module Celluloid
91
91
 
92
92
  # Provision a new worker
93
93
  def __provision_worker__
94
+ Task.current.guard_warnings = true
94
95
  while @idle.empty?
95
96
  # Wait for responses from one of the busy workers
96
97
  response = exclusive { receive { |msg| msg.is_a?(Response) } }
@@ -25,7 +25,7 @@ module Celluloid
25
25
  end
26
26
 
27
27
  attr_reader :type, :meta, :status
28
- attr_accessor :chain_id
28
+ attr_accessor :chain_id, :guard_warnings
29
29
 
30
30
  # Create a new task
31
31
  def initialize(type, meta)
@@ -35,12 +35,13 @@ module Celluloid
35
35
 
36
36
  @exclusive = false
37
37
  @dangerous_suspend = @meta ? @meta.delete(:dangerous_suspend) : false
38
+ @guard_warnings = false
38
39
 
39
40
  actor = Thread.current[:celluloid_actor]
40
41
  @chain_id = CallChain.current_id
41
42
 
42
43
  raise NotActorError, "can't create tasks outside of actors" unless actor
43
- raise "can't create tasks inside of tasks" if Thread.current[:celluloid_task]
44
+ guard "can't create tasks inside of tasks" if Thread.current[:celluloid_task]
44
45
 
45
46
  create do
46
47
  begin
@@ -93,7 +94,7 @@ module Celluloid
93
94
 
94
95
  # Resume a suspended task, giving it a value to return if needed
95
96
  def resume(value = nil)
96
- raise "Cannot resume a task from inside of a task" if Thread.current[:celluloid_task]
97
+ guard "Cannot resume a task from inside of a task" if Thread.current[:celluloid_task]
97
98
  deliver(value)
98
99
  nil
99
100
  end
@@ -141,6 +142,14 @@ module Celluloid
141
142
  def inspect
142
143
  "#<#{self.class}:0x#{object_id.to_s(16)} @type=#{@type.inspect}, @meta=#{@meta.inspect}, @status=#{@status.inspect}>"
143
144
  end
145
+
146
+ def guard(message)
147
+ if @guard_warnings
148
+ Logger.warn message if $CELLULOID_DEBUG
149
+ else
150
+ raise message if $CELLULOID_DEBUG
151
+ end
152
+ end
144
153
  end
145
154
  end
146
155
 
@@ -49,4 +49,11 @@ describe "Celluloid.pool" do
49
49
  it "terminates" do
50
50
  expect { subject.terminate }.to_not raise_exception
51
51
  end
52
+
53
+ it "handles many requests" do
54
+ futures = 10.times.map do
55
+ subject.future.process
56
+ end
57
+ futures.map(&:value)
58
+ end
52
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celluloid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-04 00:00:00.000000000 Z
11
+ date: 2013-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: timers