taskinator 0.3.7 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -2
- data/lib/taskinator.rb +6 -2
- data/lib/taskinator/persistence.rb +4 -4
- data/lib/taskinator/version.rb +1 -1
- data/spec/taskinator/persistence_spec.rb +6 -6
- data/taskinator.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f8f0c88f1bf0ade876afc82c451b310064d0e07
|
4
|
+
data.tar.gz: 920e74b55fef2506b49e9a2ec21389cf646ef72d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd62e9056ce98cf2e78aa51dd95a3ce24d14e0fb894bfc699afca93950bca9c54d9c39a9259dc180a10ca7ac97a1bf76fa133cd38058833e38a5ee114920d0e1
|
7
|
+
data.tar.gz: 9dec75c348b5a66f55526b15fe7f04e76992e574d066667134bab276c27694ae60a29bce396b1aa668ef367b6ec491ef8276034984dca769f782096ab6681a6f
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
taskinator (0.3.
|
4
|
+
taskinator (0.3.9)
|
5
5
|
builder (>= 3.2.2)
|
6
6
|
connection_pool (>= 2.2.0)
|
7
|
+
globalid (~> 0.3)
|
7
8
|
json (>= 1.8.2)
|
8
9
|
redis (>= 3.2.1)
|
9
10
|
redis-namespace (>= 1.5.2)
|
@@ -33,6 +34,8 @@ GEM
|
|
33
34
|
activesupport (>= 3.0, < 5.1)
|
34
35
|
diff-lcs (1.2.5)
|
35
36
|
docile (1.1.5)
|
37
|
+
globalid (0.3.7)
|
38
|
+
activesupport (>= 4.1.0)
|
36
39
|
i18n (0.7.0)
|
37
40
|
json (1.8.3)
|
38
41
|
method_source (0.8.2)
|
@@ -70,7 +73,7 @@ GEM
|
|
70
73
|
rspec-core (~> 3.5.0)
|
71
74
|
rspec-expectations (~> 3.5.0)
|
72
75
|
rspec-mocks (~> 3.5.0)
|
73
|
-
rspec-core (3.5.
|
76
|
+
rspec-core (3.5.3)
|
74
77
|
rspec-support (~> 3.5.0)
|
75
78
|
rspec-expectations (3.5.0)
|
76
79
|
diff-lcs (>= 1.2.0, < 2.0)
|
data/lib/taskinator.rb
CHANGED
@@ -2,6 +2,7 @@ require 'json'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'securerandom'
|
4
4
|
require 'redis-semaphore'
|
5
|
+
require 'benchmark'
|
5
6
|
|
6
7
|
require 'taskinator/version'
|
7
8
|
|
@@ -71,9 +72,12 @@ module Taskinator
|
|
71
72
|
|
72
73
|
def redis_mutex(lockid, options={}, &block)
|
73
74
|
raise ArgumentError, "requires a block" unless block_given?
|
74
|
-
|
75
|
-
|
75
|
+
m = Benchmark.measure do
|
76
|
+
redis do |r|
|
77
|
+
Redis::Semaphore.new(lockid, {:redis => r}.merge(options)).lock(&block)
|
78
|
+
end
|
76
79
|
end
|
80
|
+
logger.debug("Time spent in mutex: #{m.real}")
|
77
81
|
end
|
78
82
|
|
79
83
|
def redis_pool
|
@@ -509,14 +509,14 @@ module Taskinator
|
|
509
509
|
# special case, convert models to global id's
|
510
510
|
if values.is_a?(Array)
|
511
511
|
values = values.collect {|value|
|
512
|
-
value.respond_to?(:
|
512
|
+
value.respond_to?(:to_global_id) ? value.to_global_id : value
|
513
513
|
}
|
514
514
|
elsif values.is_a?(Hash)
|
515
515
|
values.each {|key, value|
|
516
|
-
values[key] = value.
|
516
|
+
values[key] = value.to_global_id if value.respond_to?(:to_global_id)
|
517
517
|
}
|
518
|
-
elsif values.respond_to?(:
|
519
|
-
values = values.
|
518
|
+
elsif values.respond_to?(:to_global_id)
|
519
|
+
values = values.to_global_id
|
520
520
|
end
|
521
521
|
YAML.dump(values)
|
522
522
|
end
|
data/lib/taskinator/version.rb
CHANGED
@@ -87,7 +87,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
87
87
|
}
|
88
88
|
|
89
89
|
it {
|
90
|
-
expect(subject.serialize([MockModel.new])).to eq(
|
90
|
+
expect(subject.serialize([MockModel.new])).to eq("---\n- !ruby/object:MockModel\n model_id: 1\n model_type: TypeX\n")
|
91
91
|
}
|
92
92
|
end
|
93
93
|
|
@@ -105,7 +105,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
105
105
|
}
|
106
106
|
|
107
107
|
it {
|
108
|
-
expect(subject.serialize({:foo => MockModel.new})).to eq(
|
108
|
+
expect(subject.serialize({:foo => MockModel.new})).to eq("---\n:foo: !ruby/object:MockModel\n model_id: 1\n model_type: TypeX\n")
|
109
109
|
}
|
110
110
|
end
|
111
111
|
|
@@ -123,7 +123,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
123
123
|
}
|
124
124
|
|
125
125
|
it {
|
126
|
-
expect(subject.serialize(MockModel.new)).to eq(
|
126
|
+
expect(subject.serialize(MockModel.new)).to eq("--- !ruby/object:MockModel\nmodel_id: 1\nmodel_type: TypeX\n")
|
127
127
|
}
|
128
128
|
end
|
129
129
|
end
|
@@ -144,7 +144,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
144
144
|
|
145
145
|
it {
|
146
146
|
expect_any_instance_of(MockModel).to receive(:find)
|
147
|
-
subject.deserialize(
|
147
|
+
subject.deserialize("---\n!ruby/object:MockModel\n model_id: 1\n model_type: TypeX\n")
|
148
148
|
}
|
149
149
|
end
|
150
150
|
|
@@ -163,7 +163,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
163
163
|
|
164
164
|
it {
|
165
165
|
expect_any_instance_of(MockModel).to receive(:find)
|
166
|
-
subject.deserialize(
|
166
|
+
subject.deserialize("---\n:foo: !ruby/object:MockModel\n model_id: 1\n model_type: TypeX\n")
|
167
167
|
}
|
168
168
|
end
|
169
169
|
|
@@ -182,7 +182,7 @@ describe Taskinator::Persistence, :redis => true do
|
|
182
182
|
|
183
183
|
it {
|
184
184
|
expect_any_instance_of(MockModel).to receive(:find)
|
185
|
-
subject.deserialize(
|
185
|
+
subject.deserialize("---\n!ruby/object:MockModel\n model_id: 1\n model_type: TypeX\n")
|
186
186
|
}
|
187
187
|
end
|
188
188
|
end
|
data/taskinator.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taskinator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Stefano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 3.2.2
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: globalid
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.3'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.3'
|
97
111
|
description: Simple process orchestration
|
98
112
|
email:
|
99
113
|
- virtualstaticvoid@gmail.com
|