asynchronic 1.5.0 → 1.5.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: b2bd845501396b08b9d2948649a8792af6a966cb
4
- data.tar.gz: 577a10429b1df9448d84394c85d5f38752f4380b
3
+ metadata.gz: 208fbdbb4ecc99c379e02e453f014693f0aa9b4e
4
+ data.tar.gz: d274c2fa79f7a1fafdff2de097f08dedde801c64
5
5
  SHA512:
6
- metadata.gz: 58b29093b0856f719a24efc276ab827bc83a492dfa3b781ed3ced23ab6d58e6f869989abd08c1bceb35d94712f060dec419f2d643ba1b83917b8eb0ce538feae
7
- data.tar.gz: 7f7248fdc544ac0bd902311ab4893bc02f0545b689206f1061fab5f6e4e0d334dd36c842024fb7bf9c35c764e3d7527c122ddbf7fd9830f05fce3204676e561e
6
+ metadata.gz: dc97dd65da5af0027afac0ac88623f1dbd4a12d9ec6823b1bf58c819ba6e8a53c30cd1502a59c19a64dcde64b72daca4d3db67c6c95d60f3ba52bc73fa0f9c3f
7
+ data.tar.gz: 6acd4d9faaabce8023b28b5b5b75228cbe4867259966fa06358e0e75bf77d8027d993e5192b2d5c5c3a4b265a8770827709a15225161228c8db5a208b2a7bdac
data/lib/asynchronic.rb CHANGED
@@ -19,6 +19,7 @@ module Asynchronic
19
19
  attr_config :logger, Logger.new($stdout)
20
20
  attr_config :retry_timeout, 30
21
21
  attr_config :garbage_collector_timeout, 30
22
+ attr_config :redis_data_store_sync_timeout, 0.01
22
23
 
23
24
  def self.environment
24
25
  Environment.new queue_engine, data_store
@@ -2,7 +2,6 @@ module Asynchronic
2
2
  module DataStore
3
3
  class Redis
4
4
 
5
- TIMEOUT = 0.001
6
5
  LOCKED = 'locked'
7
6
 
8
7
  include Helper
@@ -39,7 +38,7 @@ module Asynchronic
39
38
 
40
39
  def synchronize(key)
41
40
  while @connection.getset(@scope[key][LOCKED], LOCKED) == LOCKED
42
- sleep TIMEOUT
41
+ sleep Asynchronic.redis_data_store_sync_timeout
43
42
  end
44
43
  yield
45
44
  ensure
@@ -210,14 +210,15 @@ module Asynchronic
210
210
 
211
211
  def wakeup_children
212
212
  if waiting?
213
- if processes.any?(&:aborted?)
214
- childs_with_errors = processes.select(&:error)
213
+ children = processes # Cached child processes
214
+ if children.any?(&:aborted?)
215
+ childs_with_errors = children.select(&:error)
215
216
  error = childs_with_errors.any? ? "Error caused by #{childs_with_errors.map(&:name).join(', ')}" : nil
216
217
  abort! error
217
- elsif processes.all?(&:completed?)
218
+ elsif children.all?(&:completed?)
218
219
  completed!
219
220
  else
220
- processes.each do |p|
221
+ children.each do |p|
221
222
  p.enqueue if p.ready?
222
223
  end
223
224
  end
@@ -1,3 +1,3 @@
1
1
  module Asynchronic
2
- VERSION = '1.5.0'
2
+ VERSION = '1.5.1'
3
3
  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: 1.5.0
4
+ version: 1.5.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: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2018-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis