Skip to content

Commit 4238c7f

Browse files
committed
Use logging string interpolation where possible
1 parent 35b3b62 commit 4238c7f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

manage_breast_screening/notifications/management/commands/retry_failed_message_batch.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,21 @@ def handle(self, *args, **options):
4040

4141
if message_batch is None:
4242
raise CommandError(
43-
f"Message Batch with id {message_batch_id} and status of '{MessageBatchStatusChoices.FAILED_RECOVERABLE.value}' not found"
43+
(
44+
f"Message Batch with id {message_batch_id} and status of "
45+
f"'{MessageBatchStatusChoices.FAILED_RECOVERABLE.value}' not found"
46+
)
4447
)
4548

4649
queue.delete(queue_message)
47-
logger.info(f"Message Batch with id {message_batch_id} deleted from queue")
50+
logger.info("Message Batch with id %s deleted from queue", message_batch_id)
4851

4952
retry_count = int(json.loads(queue_message.content)["retry_count"])
5053
if retry_count < int(os.getenv("NOTIFICATIONS_BATCH_RETRY_LIMIT", "5")):
5154
logger.info(
52-
f"Retrying Message Batch with id {message_batch_id} with retry count {retry_count}"
55+
"Retrying Message Batch with id %s with retry count %s",
56+
message_batch_id,
57+
retry_count,
5358
)
5459

5560
try:
@@ -69,8 +74,9 @@ def handle(self, *args, **options):
6974
except Exception as e:
7075
raise CommandError(e)
7176
else:
72-
logger.info(
73-
f"Failed Message Batch with id {message_batch_id} not sent: Retry limit exceeded"
77+
logger.error(
78+
"Failed Message Batch with id %s not sent: Retry limit exceeded",
79+
message_batch_id,
7480
)
7581
message_batch.status = MessageBatchStatusChoices.FAILED_UNRECOVERABLE.value
7682
message_batch.save()

0 commit comments

Comments
 (0)