talentro-commons 0.20.8__py3-none-any.whl → 0.20.9__py3-none-any.whl

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.
@@ -141,18 +141,25 @@ class RabbitMQ:
141
141
  traceback.print_exc()
142
142
 
143
143
  # Get retry count from headers
144
- x_death = message.headers.get('x-death', [])
145
- death_count = len(x_death) if x_death else 0
144
+ x_death = message.headers.get('x-death')
145
+ death_count = 0
146
+
147
+ if isinstance(x_death, dict):
148
+ death_count = x_death.get('count', 0)
149
+ elif isinstance(x_death, list) and len(x_death) > 0:
150
+ death_count = x_death[0].get('count', 0)
146
151
 
147
152
  print(f" RabbitMQ ({queue}) - Retry attempt {death_count + 1}/{max_retries + 1}")
148
153
 
149
154
  if death_count >= max_retries:
150
155
  print(f" RabbitMQ ({queue}) - ❌ Max retries ({max_retries}) exceeded. Sending to DLQ.")
156
+ await message.nack(requeue=False)
151
157
  else:
152
158
  print(f" RabbitMQ ({queue}) - Sending to retry queue...")
159
+ retry_exchange = await self.channel.get_exchange(f"{dlx_name}.retry")
160
+ await retry_exchange.publish(message, routing_key=f"{queue}.dead")
161
+ await message.ack()
153
162
 
154
- # Nack outside of any context manager
155
- await message.nack(requeue=False)
156
163
  message_processed = True
157
164
 
158
165
  except (aio_pika.exceptions.AMQPConnectionError, aio_pika.exceptions.ChannelClosed):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: talentro-commons
3
- Version: 0.20.8
3
+ Version: 0.20.9
4
4
  Summary: This package contains all globally used code, services, models and data structures for Talentro
5
5
  License: Proprietary
6
6
  Author: Emiel van Essen
@@ -29,7 +29,7 @@ talentro/services/caching.py,sha256=mmjhXAMJ_g8D8cJqn15YqZ7ST-G5lD9MS-PmlowI7pU,
29
29
  talentro/services/clients.py,sha256=vluOrdYdDAQLyGR9-EmogLjA9OUlJtHy0tYD9LhwxKg,2174
30
30
  talentro/services/db.py,sha256=cnKCrYG7GwIu7ZZhA25D-yaXaiCJqPpzfcanWquyrBY,822
31
31
  talentro/services/google_storage.py,sha256=5r5uiDZD-76Dylc7yyRG5Ni4XNTc9xK8rC0glCRG8_8,6014
32
- talentro/services/rabbitmq.py,sha256=lMNk8Tuf34nB9I3RQ7blgP6HxG3jYjHIqHJ8snutxnQ,10370
32
+ talentro/services/rabbitmq.py,sha256=CMz3XSghfA0bZnE02kn4bZ1KWXgCtRcm3aV7pkjyt_Q,10787
33
33
  talentro/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
34
  talentro/util/attributes.py,sha256=PgJnn9LMtHkiNIaMov2HQt5944HweD6gRlAHBZrJGPA,448
35
35
  talentro/util/enum.py,sha256=YftsoJKnrn8HAjA2Q1tqIYBMrNnlq6m1b34N8hfykbE,155
@@ -41,6 +41,6 @@ talentro/vacancies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
41
41
  talentro/vacancies/dataclasses.py,sha256=E6H5fsZH4IwtBFSLDolzF6u39tEIrANtWiNVoB65P0c,15074
42
42
  talentro/vacancies/models.py,sha256=GoXr71CNzU6csf8gdmv84etb3Rm-Cdfigp1yqPI_jjQ,4822
43
43
  talentro/vacancies/taxanomy.py,sha256=B6DMq9Wbs0aXFwD9aZveSlLwAC9eq1iCO_KM-FmrV7M,6384
44
- talentro_commons-0.20.8.dist-info/METADATA,sha256=WIN613LpEEEAGE7K8jgA6VYpCdd7PPSJ7IA-BIIOCyY,1507
45
- talentro_commons-0.20.8.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
- talentro_commons-0.20.8.dist-info/RECORD,,
44
+ talentro_commons-0.20.9.dist-info/METADATA,sha256=bSo3lKfOSeBOEyRb74LcNAmCKiHKZ_ldq4-6w5h36kM,1507
45
+ talentro_commons-0.20.9.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
46
+ talentro_commons-0.20.9.dist-info/RECORD,,