legion 0.1.0 → 0.1.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: 006f2c90438dfe8c72bd8d75baab387236054d79
4
- data.tar.gz: ba2d996de7fb9386114818d1dd9779e25526bd79
3
+ metadata.gz: a87aefd96c0ca2ced0b0f812b7987f8058f0e5ae
4
+ data.tar.gz: 25c34d02b24710268cc5603933f719216b49b8aa
5
5
  SHA512:
6
- metadata.gz: f3978c05cbf8fc99c6126336d8d540c45a1c51c75ee871985f03f6955366e2947005921a9abdc17e04df454d09b7f1ba9435c8fc8eee8074261f89a76fb148e3
7
- data.tar.gz: e6691c66995540326c284c7adaeeabfbe09ba8d5a7e26a57189405c8be5aec4420df59073a5277cfa0506502b7809cb4b74b550ca6f66f08ffe954099d8f6c5a
6
+ metadata.gz: d810d6e3f42466d19aeae9d6dda3f5be3511c8010912f1dfb939c9a8566df8fb1396c9001233a2554350969299a84665ca8a946587fc55eb71f4297977fd1e0e
7
+ data.tar.gz: 3794bbd9b2a56f203f78c4c7ce65a7e696bcb33da767ba02711ec63b46a6054ecadf52735cb42532cb0faab741832774df5b67c27c3c5ace2114a83a4fca661a
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby --
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require "legion"
4
4
  #require_relative "../lib/legion"
@@ -10,8 +10,9 @@ class Example < Legion::Object
10
10
  end
11
11
 
12
12
  def work(index)
13
- puts "working on: #{index} ... sleeping for 2 seconds"
14
- sleep 2
13
+ duration = rand(4)
14
+ puts "working on: #{index} ... sleeping for #{duration} seconds"
15
+ sleep duration
15
16
  end
16
17
  end
17
18
 
@@ -19,7 +20,7 @@ def run_example
19
20
  puts "Starting 4 processes to run the demo."
20
21
  supervisor = Legion::Supervisor.new(Example, processes: 4, port: 52042)
21
22
  supervisor.start
22
- 1000.times { |i| supervisor.work(i) }
23
+ 100.times { |i| supervisor.work(i) }
23
24
  supervisor.stop
24
25
  end
25
26
 
@@ -37,11 +37,15 @@ module Legion
37
37
  end
38
38
 
39
39
  def get_remote_instance
40
- @index ||= 0
41
- remote_instance = remote_instances[@index]
42
- sleep 0.01 while remote_instance.busy?
43
- @index += 1
44
- @index = 0 if @index >= remote_instances.length
40
+ remote_instance = nil
41
+ while remote_instance.nil?
42
+ (0..remote_instances.length - 1).each do |index|
43
+ next if remote_instances[index].busy?
44
+ remote_instance = remote_instances[index]
45
+ break
46
+ end
47
+ sleep 0.01 if remote_instance.nil?
48
+ end
45
49
  remote_instance
46
50
  end
47
51
 
@@ -1,3 +1,3 @@
1
1
  module Legion
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,44 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Hopkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-05 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Concurrent processing made easy... even for MRI.
41
+ description: Concurrent processing made easy.
42
42
  email:
43
43
  - natehop@gmail.com
44
44
  executables:
@@ -46,11 +46,11 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - bin/legion_demo
50
+ - lib/legion.rb
49
51
  - lib/legion/object.rb
50
52
  - lib/legion/supervisor.rb
51
53
  - lib/legion/version.rb
52
- - lib/legion.rb
53
- - bin/legion_demo
54
54
  homepage: https://github.com/hopsoft/legion
55
55
  licenses:
56
56
  - MIT
@@ -61,19 +61,19 @@ require_paths:
61
61
  - lib
62
62
  required_ruby_version: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - '>='
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 2.0.0
67
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  requirements:
69
- - - '>='
69
+ - - ">="
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
73
  rubyforge_project:
74
- rubygems_version: 2.0.3
74
+ rubygems_version: 2.2.2
75
75
  signing_key:
76
76
  specification_version: 4
77
- summary: Concurrent processing made easy... even for MRI.
77
+ summary: Concurrent processing made easy.
78
78
  test_files: []
79
79
  has_rdoc: