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 +4 -4
- data/lib/rabbit_carrots/tasks/rmq.rake +14 -0
- data/lib/rabbit_carrots/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8da9ad2d662b3217200cf1746b14244f8d2fe3c272fbee89eb7a6b8e7d47516
|
4
|
+
data.tar.gz: 9b5288fe33e7231bd75fe85112ed6ce1414b268f034f2fb6c3031abc03b14c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'
|
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.
|
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-
|
11
|
+
date: 2023-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|