qik-loops 2.1.0 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/generators/loops/templates/script/loops +1 -0
- data/lib/loops/engine.rb +4 -4
- data/lib/loops/worker.rb +2 -2
- data/{loops.gemspec → qik-loops.gemspec} +8 -8
- metadata +3 -3
data/VERSION.yml
CHANGED
data/lib/loops/engine.rb
CHANGED
@@ -119,7 +119,7 @@ class Loops::Engine
|
|
119
119
|
info "Starting loop: #{name}"
|
120
120
|
info " - config: #{config.inspect}"
|
121
121
|
|
122
|
-
loop_proc = Proc.new do
|
122
|
+
loop_proc = Proc.new do |options|
|
123
123
|
the_logger = begin
|
124
124
|
if Loops.logger.is_a?(Loops::Logger) && @global_config['workers_engine'] == 'fork'
|
125
125
|
# this is happening right after the fork, therefore no need for teardown at the end of the proc
|
@@ -152,15 +152,15 @@ class Loops::Engine
|
|
152
152
|
# reseed the random number generator in case Loops calls
|
153
153
|
# srand or rand prior to forking
|
154
154
|
srand
|
155
|
-
the_loop.run
|
155
|
+
the_loop.run(options)
|
156
156
|
end
|
157
157
|
|
158
158
|
# If the loop is in debug mode, no need to use all kinds of
|
159
159
|
# process managers here
|
160
160
|
if config['debug_loop']
|
161
|
-
loop_proc.call
|
161
|
+
loop_proc.call(:id => 0, :count => 1)
|
162
162
|
else
|
163
|
-
@pm.start_workers(name, config['workers_number'] || 1) { loop_proc.call }
|
163
|
+
@pm.start_workers(name, config['workers_number'] || 1) { |*args| loop_proc.call(args) }
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
data/lib/loops/worker.rb
CHANGED
@@ -2,7 +2,7 @@ module Loops
|
|
2
2
|
class Worker
|
3
3
|
attr_reader :name
|
4
4
|
attr_reader :pid
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :worker_options
|
6
6
|
|
7
7
|
def initialize(name, pm, engine, options = {}, &blk)
|
8
8
|
raise ArgumentError, "Need a worker block!" unless block_given?
|
@@ -36,7 +36,7 @@ module Loops
|
|
36
36
|
normal_exit = false
|
37
37
|
begin
|
38
38
|
$0 = "loop worker: #{@name}\0"
|
39
|
-
@worker_block.call
|
39
|
+
@worker_block.call(worker_options)
|
40
40
|
normal_exit = true
|
41
41
|
exit(0)
|
42
42
|
rescue Exception => e
|
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{loops}
|
8
|
-
s.version = "2.
|
7
|
+
s.name = %q{qik-loops}
|
8
|
+
s.version = "2.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Alexey Kovyrin", "Dmytro Shteflyuk"]
|
12
|
-
s.date = %q{2010-03-
|
11
|
+
s.authors = ["Alexey Kovyrin", "Dmytro Shteflyuk", "Gleb Pomykalov"]
|
12
|
+
s.date = %q{2010-03-25}
|
13
13
|
s.description = %q{Loops is a small and lightweight framework for Ruby on Rails, Merb and other ruby frameworks created to support simple background loops in your application which are usually used to do some background data processing on your servers (queue workers, batch tasks processors, etc).}
|
14
|
-
s.email = %q{
|
14
|
+
s.email = %q{gleb.pomykalov@qik.com}
|
15
15
|
s.executables = ["loops", "loops-memory-stats"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"LICENSE",
|
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
|
|
53
53
|
"lib/loops/version.rb",
|
54
54
|
"lib/loops/worker.rb",
|
55
55
|
"lib/loops/worker_pool.rb",
|
56
|
-
"loops.gemspec",
|
56
|
+
"qik-loops.gemspec",
|
57
57
|
"spec/loop_lock_spec.rb",
|
58
58
|
"spec/loops/base_spec.rb",
|
59
59
|
"spec/loops/cli_spec.rb",
|
@@ -67,11 +67,11 @@ Gem::Specification.new do |s|
|
|
67
67
|
"spec/rails/config/loops.yml",
|
68
68
|
"spec/spec_helper.rb"
|
69
69
|
]
|
70
|
-
s.homepage = %q{http://github.com/
|
70
|
+
s.homepage = %q{http://github.com/glebpom/loops}
|
71
71
|
s.rdoc_options = ["--charset=UTF-8"]
|
72
72
|
s.require_paths = ["lib"]
|
73
73
|
s.rubygems_version = %q{1.3.6}
|
74
|
-
s.summary = %q{Simple background loops framework for ruby}
|
74
|
+
s.summary = %q{Simple background loops framework for ruby (qik.com)}
|
75
75
|
s.test_files = [
|
76
76
|
"spec/loop_lock_spec.rb",
|
77
77
|
"spec/loops/base_spec.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 2.1.
|
8
|
+
- 3
|
9
|
+
version: 2.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Alexey Kovyrin
|
@@ -66,7 +66,7 @@ files:
|
|
66
66
|
- lib/loops/version.rb
|
67
67
|
- lib/loops/worker.rb
|
68
68
|
- lib/loops/worker_pool.rb
|
69
|
-
- loops.gemspec
|
69
|
+
- qik-loops.gemspec
|
70
70
|
- spec/loop_lock_spec.rb
|
71
71
|
- spec/loops/base_spec.rb
|
72
72
|
- spec/loops/cli_spec.rb
|