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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0dc34a77947a18f75fccbf9b5ccd71e7bcc43591
4
- data.tar.gz: b47ec466da7225f0fb196965a94be1336f87cf06
3
+ metadata.gz: 4f8f0c88f1bf0ade876afc82c451b310064d0e07
4
+ data.tar.gz: 920e74b55fef2506b49e9a2ec21389cf646ef72d
5
5
  SHA512:
6
- metadata.gz: 76c92d0969d760410749ee0cdcf75e26e0cf1fbb2ff0c10bd61cdb166940d88c8b62c97098515c869de6f8314dc80f525ec825c7470c139cdf788227424c70de
7
- data.tar.gz: a077db5955b84d3cb17b88644c33632404f4f1132da92aaab1b7c579f090b853176a5cc5bf2b680099939ec5a2482c40b68b2c2a4ce0d6caf6db4709f0e58729
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.7)
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.2)
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
- redis do |r|
75
- Redis::Semaphore.new(lockid, {:redis => r}.merge(options)).lock(&block)
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?(:global_id) ? value.global_id : value
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.global_id if value.respond_to?(:global_id)
516
+ values[key] = value.to_global_id if value.respond_to?(:to_global_id)
517
517
  }
518
- elsif values.respond_to?(:global_id)
519
- values = values.global_id
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
@@ -1,3 +1,3 @@
1
1
  module Taskinator
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.9"
3
3
  end
@@ -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(YAML.dump([{:model_id => 1, :model_type => 'TypeX'}]))
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(YAML.dump({:foo => {:model_id => 1, :model_type => 'TypeX'}}))
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(YAML.dump({:model_id => 1, :model_type => 'TypeX'}))
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(YAML.dump([MockModel.new]))
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(YAML.dump({:foo => MockModel.new}))
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(YAML.dump(MockModel.new))
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
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'connection_pool' , '>= 2.2.0'
28
28
  spec.add_dependency 'json' , '>= 1.8.2'
29
29
  spec.add_dependency 'builder' , '>= 3.2.2'
30
+ spec.add_dependency 'globalid' , '~> 0.3'
30
31
  end
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.7
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-08-18 00:00:00.000000000 Z
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