arya-pandemic 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -117,9 +117,11 @@ The servers are going to try to bind to localhost:4000 and localhost:4001 so mak
117
117
  By default, the handler runs in the same Ruby process as Pandemic. By setting the fork\_for\_processor to true in pandemic\_server.yml, you can have Pandemic fork to new processes to run the process method. This is particularly useful when your process method goes to MySQL which locks the entire process until MySQL returns.
118
118
 
119
119
  ## Change History
120
- Version 0.3.1
120
+ **Version 0.3.1**
121
+
121
122
  * Changed map to partition to more accurately reflect what it does. This breaks backwards compatibility, but all you have to do is rename your method.
122
- Version 0.3.0
123
+
124
+ **Version 0.3.0**
123
125
 
124
126
  * Pandemic can now fork to call the process method
125
127
  * Pandemic server now expects a class instead of a instance of the handler when booting the server, it will call the initializer method once per process.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('pandemic', '0.3.3') do |p|
5
+ Echoe.new('pandemic', '0.3.4') do |p|
6
6
  p.description = "Distribute MapReduce to any of the workers and it will spread, like a pandemic."
7
7
  p.url = "https://github.com/arya/pandemic/"
8
8
  p.author = "Arya Asemanfar"
@@ -40,7 +40,8 @@ module Pandemic
40
40
  @connection_proxies[key]
41
41
  end
42
42
 
43
- def request(body, key = nil, options = {})
43
+ def request(body, key = nil, options = nil)
44
+ key, options = nil, key if key.is_a?(Hash)
44
45
  with_connection(key) do |socket|
45
46
  begin
46
47
  flags = []
@@ -12,7 +12,7 @@ module Pandemic
12
12
  @connection = connection
13
13
  @server = server
14
14
  @received_requests = 0
15
- @responded_requests = 0
15
+ @responded_requests = MutexCounter.new
16
16
  @current_request = nil
17
17
  end
18
18
 
@@ -38,7 +38,10 @@ module Pandemic
38
38
  body = @connection.read(size)
39
39
  debug("Finished reading request body")
40
40
  if flags.include?(REQUEST_FLAGS[:async])
41
- Thread.new { handle_request(body) }
41
+ Thread.new do
42
+ handle_request(body)
43
+ @responded_requests.inc
44
+ end
42
45
  else
43
46
  response = handle_request(body)
44
47
 
@@ -48,8 +51,8 @@ module Pandemic
48
51
  @connection.write("#{response.size}\n#{response}")
49
52
  @connection.flush
50
53
  debug("Finished writing response to client")
54
+ @responded_requests.inc
51
55
  end
52
- @responded_requests += 1
53
56
  end
54
57
  end
55
58
  rescue DisconnectClient
@@ -237,7 +237,7 @@ module Pandemic
237
237
  results[:late_responses] = Request.total_late_responses
238
238
  results[:pending_requests] = @clients_mutex.synchronize do
239
239
  @clients.inject(0) do |pending, client|
240
- pending + (client.received_requests - client.responded_requests)
240
+ pending + (client.received_requests - client.responded_requests.to_i)
241
241
  end
242
242
  end
243
243
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pandemic}
5
- s.version = "0.3.3"
5
+ s.version = "0.3.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Arya Asemanfar"]
9
- s.date = %q{2009-06-18}
9
+ s.date = %q{2009-06-21}
10
10
  s.description = %q{Distribute MapReduce to any of the workers and it will spread, like a pandemic.}
11
11
  s.email = %q{aryaasemanfar@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/pandemic/client_side/cluster_connection.rb", "lib/pandemic/client_side/config.rb", "lib/pandemic/client_side/connection.rb", "lib/pandemic/client_side/connection_proxy.rb", "lib/pandemic/client_side/pandemize.rb", "lib/pandemic/connection_pool.rb", "lib/pandemic/mutex_counter.rb", "lib/pandemic/server_side/client.rb", "lib/pandemic/server_side/config.rb", "lib/pandemic/server_side/handler.rb", "lib/pandemic/server_side/peer.rb", "lib/pandemic/server_side/processor.rb", "lib/pandemic/server_side/request.rb", "lib/pandemic/server_side/server.rb", "lib/pandemic/util.rb", "lib/pandemic.rb", "README.markdown"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arya-pandemic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arya Asemanfar
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-18 00:00:00 -07:00
12
+ date: 2009-06-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency