rabbit_carrots 0.1.15 → 0.1.17

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: 6789a2811a7f1c151591246c4e0499c6ee5646afcf2a3127e6b6e845c66bf40b
4
- data.tar.gz: b957f04668bc4f790478facd3a0737fea6779b5938f0d640b7b1d7edd36d8d95
3
+ metadata.gz: 29ee56c912e4fabd7a4dee2b9e5a30b7797e36f385cee27d0e63216ebd9e9e1a
4
+ data.tar.gz: 4f8ceb93851568835c9deee10b4b9cdae7a292574c28627234039b3cdae39242
5
5
  SHA512:
6
- metadata.gz: 9a6c24f33e2490508340601b680be096d88cb97c98a656912f7cc114e3ff662fbc77958d26df05d36353140f1541534ac357a0b41f9cc07b95564130b67fbb53
7
- data.tar.gz: 6fc7bb72c7bdafb129a200683e1b0c5822ab1e418ebfae38ce63a3aa37c344f191037eab7a379f9c136f07a2c6bcfd9b4b8becf9a06988afc5b2d8dc31c20fa7
6
+ metadata.gz: 06f4a05b94bd703fc6cce405f8579c5be9431e768e80f9a8f1767a1897f9def88b430cc27a803953f59a42c6df7ebc7de2757ecaf61626dc7e7cffc512c0b6cd
7
+ data.tar.gz: 2d102d1745e169b3e1a016a028fbe153715132509385fe102dfdc68e4a1c28643da2ccfa43c7bccf0e2ff7f30d3bbc2f5c2e2f6063001befdbd1f60476d0070d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbit_carrots (0.1.15)
4
+ rabbit_carrots (0.1.17)
5
5
  bunny (>= 2.19.0)
6
6
  connection_pool (~> 2.3.0)
7
7
 
@@ -15,7 +15,7 @@ GEM
15
15
  tzinfo (~> 2.0)
16
16
  amq-protocol (2.3.2)
17
17
  ast (2.4.2)
18
- bunny (2.19.0)
18
+ bunny (2.20.3)
19
19
  amq-protocol (~> 2.3, >= 2.3.1)
20
20
  sorted_set (~> 1, >= 1.0.2)
21
21
  concurrent-ruby (1.1.10)
@@ -28,10 +28,10 @@ GEM
28
28
  parallel (1.22.1)
29
29
  parser (3.1.2.1)
30
30
  ast (~> 2.4.1)
31
- rack (3.0.1)
31
+ rack (3.0.4.2)
32
32
  rainbow (3.1.1)
33
33
  rake (13.0.6)
34
- rbtree (0.4.5)
34
+ rbtree (0.4.6)
35
35
  regexp_parser (2.6.1)
36
36
  rexml (3.2.5)
37
37
  rspec (3.12.0)
@@ -47,9 +47,23 @@ def run_task(queue_name:, handler_class:, routing_keys:)
47
47
  rescue RabbitCarrots::EventHandlers::Errors::NackAndRequeueMessage => _e
48
48
  Rails.logger.info "Nacked and Requeued message: #{payload}"
49
49
  channel.nack(delivery_info.delivery_tag, false, true)
50
+ rescue ActiveRecord::NotNullViolation, ActiveRecord::RecordInvalid => e
51
+ # on null constraint violation, we want to ack the message
52
+ Rails.logger.error "Null constraint or Invalid violation: #{payload}. Error: #{e.message}"
53
+ channel.ack(delivery_info.delivery_tag, false)
54
+ rescue ActiveRecord::ConnectionNotEstablished => e
55
+ # on connection not established, we want to requeue the message and sleep for 3 seconds
56
+ Rails.logger.error "Error connection not established to the database: #{payload}. Error: #{e.message}"
57
+ # delay for 3 seconds before requeuing
58
+ sleep 3
59
+ channel.nack(delivery_info.delivery_tag, false, true)
50
60
  rescue StandardError => e
51
61
  Rails.logger.error "Error handling message: #{payload}. Error: #{e.message}"
62
+ # requeue the message then kill the container
63
+ sleep 3
52
64
  channel.nack(delivery_info.delivery_tag, false, true)
65
+ # kill the container with sigterm
66
+ Process.kill('SIGTERM', Process.pid)
53
67
  end
54
68
 
55
69
  Rails.logger.info 'RUN TASK ENDED'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RabbitCarrots
4
- VERSION = '0.1.15'
4
+ VERSION = '0.1.17'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbit_carrots
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brusk Awat
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-03 00:00:00.000000000 Z
11
+ date: 2023-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubygems_version: 3.3.7
88
+ rubygems_version: 3.4.1
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: A simple RabbitMQ consumer task