event_store_client 0.1.2 → 0.1.3

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
  SHA256:
3
- metadata.gz: 264ab7bf160dd4fafffd13ac73f15ce0ab6bffa2f762c0ee4da6cb628f70ec6a
4
- data.tar.gz: 73c9478c8fc52f4729cafb4c55181afecc006269e2148fee2edb4830df9bab31
3
+ metadata.gz: 9e81933b68523d17042d1f99dea18e5ff7eb37e78a454f79aa90be7f49b60cdf
4
+ data.tar.gz: d8491b83c7a910c9837d24c3be75ba0e906056c05ce3bfbbc7f78c39ee6f4986
5
5
  SHA512:
6
- metadata.gz: 64e69a708344ab5cbf7b94a539220e07ac0564374f36edbabfc63a79a4bbd76396053b4b3d1f04d0067626555431de1f8966686008bb2227225fca79d7d94beb
7
- data.tar.gz: 7c96a05e7f86c5b12c562de3642ca908bfcb536f3393425a99c686f491d461183bdd74b800ece5c5beebed3ba5558d31dac9acdf679d45b3c41cd018f7b0fdb9
6
+ metadata.gz: 0f20a8af161ceab94386cfcb63bb1912c136925beac78691f5cfda3498765353cc18ff5d4899f61903702a0f1b8d107feb9a68b9a119349cdd04537adcacd40b
7
+ data.tar.gz: 72062cefec94fae885535789e9bb0e282117bb2d634b06e4c151178ba83e9e4af4936a3b1e5c7eb1e32660735c72ee345bcc8f1092aa796c2fca148dc39e37a0
@@ -27,17 +27,19 @@ module EventStoreClient
27
27
  loop do
28
28
  create_pid_file
29
29
  Thread.handle_interrupt(Interrupt => :never) do
30
- Thread.handle_interrupt(Interrupt => :immediate) do
31
- broker.call(subscriptions)
30
+ begin # rubocop:disable Style/RedundantBegin
31
+ Thread.handle_interrupt(Interrupt => :immediate) do
32
+ broker.call(subscriptions)
33
+ end
34
+ rescue Exception => e # rubocop:disable Lint/RescueException
35
+ # When the thread had been interrupted or broker.call returned an error
36
+ sleep(interval) # wait for events to be processed
37
+ delete_pid_file
38
+ error_handler&.call(e)
39
+ ensure
40
+ # this code is run always
41
+ Thread.stop
32
42
  end
33
- rescue Exception => e # rubocop:disable Lint/RescueException
34
- # When the thread had been interrupted or broker.call returned an error
35
- sleep(interval) # wait for events to be processed
36
- delete_pid_file
37
- error_handler&.call(e)
38
- ensure
39
- # this code is run always
40
- Thread.stop
41
43
  end
42
44
  end
43
45
  end
@@ -79,12 +81,12 @@ module EventStoreClient
79
81
  end
80
82
 
81
83
  def create_pid_file
82
- return unless File.exist?(config.pid_path)
83
- File.open(config.pid_path, 'w') { |file| file.write(SecureRandom.uuid) }
84
+ Dir.mkdir('tmp') unless File.exist?('tmp')
85
+ File.open(config.pid_path, 'w') { |file| file.write(Process.pid) }
84
86
  end
85
87
 
86
88
  def delete_pid_file
87
- File.delete(config.pid_path)
89
+ File.delete(config.pid_path) if File.exist?(config.pid_path)
88
90
  end
89
91
  end
90
92
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EventStoreClient
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Wilgosz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2019-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-schema