asynchronic 3.0.1 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +7 -10
  3. data/README.md +1 -2
  4. data/asynchronic.gemspec +2 -3
  5. data/lib/asynchronic.rb +8 -0
  6. data/lib/asynchronic/data_store/in_memory.rb +17 -15
  7. data/lib/asynchronic/data_store/key.rb +3 -3
  8. data/lib/asynchronic/data_store/lazy_value.rb +5 -3
  9. data/lib/asynchronic/data_store/redis.rb +22 -14
  10. data/lib/asynchronic/data_store/scoped_store.rb +18 -19
  11. data/lib/asynchronic/environment.rb +3 -3
  12. data/lib/asynchronic/error.rb +2 -3
  13. data/lib/asynchronic/garbage_collector.rb +2 -1
  14. data/lib/asynchronic/job.rb +12 -12
  15. data/lib/asynchronic/notifier/broadcaster.rb +8 -4
  16. data/lib/asynchronic/process.rb +42 -40
  17. data/lib/asynchronic/queue_engine/in_memory.rb +17 -11
  18. data/lib/asynchronic/queue_engine/ost.rb +7 -5
  19. data/lib/asynchronic/queue_engine/synchronic.rb +19 -7
  20. data/lib/asynchronic/version.rb +1 -1
  21. data/lib/asynchronic/worker.rb +7 -10
  22. data/spec/data_store/data_store_examples.rb +17 -9
  23. data/spec/data_store/in_memory_spec.rb +0 -2
  24. data/spec/data_store/key_spec.rb +1 -1
  25. data/spec/data_store/lazy_value_examples.rb +7 -5
  26. data/spec/data_store/redis_spec.rb +4 -10
  27. data/spec/expectations.rb +2 -2
  28. data/spec/facade_spec.rb +3 -3
  29. data/spec/jobs.rb +10 -10
  30. data/spec/minitest_helper.rb +5 -12
  31. data/spec/process/life_cycle_examples.rb +25 -23
  32. data/spec/process/life_cycle_in_memory_spec.rb +0 -1
  33. data/spec/process/life_cycle_redis_spec.rb +0 -1
  34. data/spec/queue_engine/in_memory_spec.rb +1 -3
  35. data/spec/queue_engine/ost_spec.rb +1 -7
  36. data/spec/queue_engine/queue_engine_examples.rb +17 -9
  37. data/spec/queue_engine/synchronic_spec.rb +1 -1
  38. data/spec/worker/in_memory_spec.rb +1 -2
  39. data/spec/worker/redis_spec.rb +0 -6
  40. data/spec/worker/worker_examples.rb +6 -4
  41. metadata +11 -20
@@ -22,7 +22,7 @@ describe Asynchronic::QueueEngine::Synchronic do
22
22
  Asynchronic.queue_engine.stub BasicJob do |process|
23
23
  process.params[:input] + 19
24
24
  end
25
-
25
+
26
26
  pid = BasicJob.enqueue input: 1
27
27
  process = Asynchronic[pid]
28
28
  process.result.must_equal 20
@@ -1,5 +1,4 @@
1
1
  require 'minitest_helper'
2
- require_relative './worker_examples'
3
2
 
4
3
  describe Asynchronic::Worker, 'InMemory' do
5
4
 
@@ -8,5 +7,5 @@ describe Asynchronic::Worker, 'InMemory' do
8
7
  let(:notifier) { Asynchronic::Notifier::InMemory.new }
9
8
 
10
9
  include WorkerExamples
11
-
10
+
12
11
  end
@@ -1,5 +1,4 @@
1
1
  require 'minitest_helper'
2
- require_relative './worker_examples'
3
2
 
4
3
  describe Asynchronic::Worker, 'Redis' do
5
4
 
@@ -7,11 +6,6 @@ describe Asynchronic::Worker, 'Redis' do
7
6
  let(:data_store) { Asynchronic::DataStore::Redis.new :asynchronic_test}
8
7
  let(:notifier) { Asynchronic::Notifier::Broadcaster.new }
9
8
 
10
- after do
11
- data_store.clear
12
- queue_engine.clear
13
- end
14
-
15
9
  include WorkerExamples
16
10
 
17
11
  end
@@ -1,5 +1,7 @@
1
1
  module WorkerExamples
2
2
 
3
+ extend Minitest::Spec::DSL
4
+
3
5
  let(:env) { Asynchronic::Environment.new queue_engine, data_store, notifier }
4
6
  let(:queue_name) { :test_worker }
5
7
  let(:queue) { env.queue queue_name }
@@ -27,7 +29,7 @@ module WorkerExamples
27
29
 
28
30
  Thread.new do
29
31
  loop { break if queue.empty? }
30
- worker.stop
32
+ worker.stop
31
33
  end
32
34
 
33
35
  worker.start
@@ -45,10 +47,10 @@ module WorkerExamples
45
47
 
46
48
  Asynchronic::Worker.start :test_worker do |worker|
47
49
  loop { break if worker.queue.empty? }
48
- worker.stop
50
+ worker.stop
49
51
  end
50
-
51
- processes.each { |p| p.must_be :completed? }
52
+
53
+ processes.each { |p| p.must_be :completed? }
52
54
  end
53
55
 
54
56
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asynchronic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-04 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ost
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.2
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - "~>"
39
42
  - !ruby/object:Gem::Version
40
43
  version: '1.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.2
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: class_config
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -80,34 +86,20 @@ dependencies:
80
86
  - - "~>"
81
87
  - !ruby/object:Gem::Version
82
88
  version: '1.0'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.12'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.12'
97
89
  - !ruby/object:Gem::Dependency
98
90
  name: rake
99
91
  requirement: !ruby/object:Gem::Requirement
100
92
  requirements:
101
93
  - - "~>"
102
94
  - !ruby/object:Gem::Version
103
- version: '11.0'
95
+ version: '12.0'
104
96
  type: :development
105
97
  prerelease: false
106
98
  version_requirements: !ruby/object:Gem::Requirement
107
99
  requirements:
108
100
  - - "~>"
109
101
  - !ruby/object:Gem::Version
110
- version: '11.0'
102
+ version: '12.0'
111
103
  - !ruby/object:Gem::Dependency
112
104
  name: minitest
113
105
  requirement: !ruby/object:Gem::Requirement
@@ -305,8 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
305
297
  - !ruby/object:Gem::Version
306
298
  version: '0'
307
299
  requirements: []
308
- rubyforge_project:
309
- rubygems_version: 2.6.8
300
+ rubygems_version: 3.0.8
310
301
  signing_key:
311
302
  specification_version: 4
312
303
  summary: DSL for asynchronic pipeline using queues over Redis