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