rabbit_carrots 0.1.15 → 0.1.16

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: 6789a2811a7f1c151591246c4e0499c6ee5646afcf2a3127e6b6e845c66bf40b
4
- data.tar.gz: b957f04668bc4f790478facd3a0737fea6779b5938f0d640b7b1d7edd36d8d95
3
+ metadata.gz: c8da9ad2d662b3217200cf1746b14244f8d2fe3c272fbee89eb7a6b8e7d47516
4
+ data.tar.gz: 9b5288fe33e7231bd75fe85112ed6ce1414b268f034f2fb6c3031abc03b14c56
5
5
  SHA512:
6
- metadata.gz: 9a6c24f33e2490508340601b680be096d88cb97c98a656912f7cc114e3ff662fbc77958d26df05d36353140f1541534ac357a0b41f9cc07b95564130b67fbb53
7
- data.tar.gz: 6fc7bb72c7bdafb129a200683e1b0c5822ab1e418ebfae38ce63a3aa37c344f191037eab7a379f9c136f07a2c6bcfd9b4b8becf9a06988afc5b2d8dc31c20fa7
6
+ metadata.gz: 353444e8b88fe16bfb4666eb3551873caaba9b5b78f6d70973e0f62bd856a063e0e9483b46204e23bdc92d14b744f10f6920db176c86893b00e14c686a8c5684
7
+ data.tar.gz: 1d003c714f6d26a9c68cacc740bc57e044d80f9dfb47bf1e4f40416f2989f65e1ed4f2be6b9690159f4ddb8366f9e253cfa31aa5b98cce95decda71215087c3d
@@ -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.16'
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.16
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-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bunny