midget_jobs 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0381bb924f700b2ab31f3bcee872560499d312666ddac89221f592b9fde9af19'
4
- data.tar.gz: f3c51ee3b9950148ec5b4c0803dea0380945c5e34a5672cceb37e52c8ff881b5
3
+ metadata.gz: f31ce7256430433d6371404650a9a13eed0e22bcabf74dae66fad28ede2a037c
4
+ data.tar.gz: 70dd350c6c5ab4c64048e7dd120f9f7a8ab0e5586808a101df1dd4a04b27a859
5
5
  SHA512:
6
- metadata.gz: c37ac71de44ca971da13aae9b8a2a17e2b7777904ca0a8fa777c495a2c5d3a1d7276b3b447937e01b734bb45b9caaf34fbd12961731cfa6f36f9e01849768781
7
- data.tar.gz: 5f3f5b3e68a5b3876cf8df4f3b652c8cf64d60361eaa55ec57fd6a9d2e3b755051b0810019e83cdb7fe31bc76d90937c7662fe17fed2d04c69d5c77a32276031
6
+ metadata.gz: 3eadc0b0adf4aa7eb624e1a0544ce985d1740e912793363b54bced5cc0cab9ba741e4a71bf8b126fccd9999905d94cfb48f49f1299f7c4f19c9fd92698c33309
7
+ data.tar.gz: 603cb4139df7662a141acb2fdd1966a2875af20e4ed4bce843b1ed1422731ac10455bee3af9a51775cb2fa5f8847ea2bfb65db5d25890256fc0e66ec81d5c0ee
data/README.md CHANGED
@@ -30,6 +30,24 @@ Then run
30
30
  $ rails generate midget_jobs:install
31
31
 
32
32
  This generator creates an initializer file at config/initializers and migrations to db/migrate
33
+
34
+ #### With Puma's multiple workers on production
35
+
36
+ In file `config/initializers/midget_jobs.rb` disable start with puma:
37
+
38
+ ...
39
+ if Rails.const_defined?('Server')# || $0.include?('puma')
40
+
41
+ In file `config/puma/production.rb` update `on_worker_boot do` block as:
42
+
43
+ ...
44
+ on_worker_boot do
45
+ ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
46
+ Rails.logger.debug 'on_worker_boot starting jobs'
47
+
48
+ MidgetJobs.initialize_workers
49
+ ...
50
+ end
33
51
 
34
52
  ## Usage
35
53
 
@@ -1,3 +1,3 @@
1
1
  module MidgetJobs
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -13,8 +13,16 @@ module PostgresNotificationsListener
13
13
  Rails.logger.info "postgres #{event.inspect}, pid: #{pid.inspect}, data: #{data.inspect}"
14
14
  process_notification(data)
15
15
  end
16
+ rescue ActiveRecord::StatementInvalid => e
17
+ Rails.logger.error "Ex #{name} listening_job wait_for_notify #{e}-retrying!"
18
+ if e.to_s.include?('PG::ConnectionBad')
19
+ Rails.logger.error "Reestablish AR connection..."
20
+ ActiveRecord::Base.connection.verify!
21
+ end
22
+ sleep 0.1
23
+ retry
16
24
  rescue StandardError => e
17
- Rails.logger.error "-----------Ex #{name} listening_job wait_for_notify #{e}-retrying!------------"
25
+ Rails.logger.error "Ex #{name} listening_job wait_for_notify #{e}-retrying!"
18
26
  retry
19
27
  end
20
28
  end.abort_on_exception = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midget_jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - josefchmel
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-25 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler