fix
This commit is contained in:
@@ -53,7 +53,6 @@ def get_queue_url(domain):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def publish_to_sns(topic_arn, message_body, msg_id):
|
def publish_to_sns(topic_arn, message_body, msg_id):
|
||||||
"""Versucht SNS Publish. Gibt True bei Erfolg, False bei Topic-Not-Found."""
|
|
||||||
attempt = 0
|
attempt = 0
|
||||||
while attempt < MAX_RETRIES:
|
while attempt < MAX_RETRIES:
|
||||||
try:
|
try:
|
||||||
@@ -65,8 +64,9 @@ def publish_to_sns(topic_arn, message_body, msg_id):
|
|||||||
return True
|
return True
|
||||||
except ClientError as e:
|
except ClientError as e:
|
||||||
error_code = e.response['Error']['Code']
|
error_code = e.response['Error']['Code']
|
||||||
if error_code == 'NotFound' or error_code == 'NotFoundException':
|
# Fallback auf SQS bei Topic-nicht-gefunden ODER fehlender Berechtigung
|
||||||
logger.info(f"ℹ️ SNS Topic not found for {topic_arn} — falling back to SQS")
|
if error_code in ('NotFound', 'NotFoundException', 'AuthorizationError'):
|
||||||
|
logger.info(f"ℹ️ SNS unavailable for {topic_arn} ({error_code}) — falling back to SQS")
|
||||||
return False
|
return False
|
||||||
attempt += 1
|
attempt += 1
|
||||||
logger.warning(f"Retry {attempt}/{MAX_RETRIES} SNS: {error_code}")
|
logger.warning(f"Retry {attempt}/{MAX_RETRIES} SNS: {error_code}")
|
||||||
|
|||||||
Reference in New Issue
Block a user