Skip to content

Commit 5e694bc

Browse files
committed
common.clients
1 parent 8a54539 commit 5e694bc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lambdas/batch_processor_filter/src/batch_file_repository.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
from csv import writer
44
from io import BytesIO, StringIO
55

6-
import boto3
7-
86
from batch_file_created_event import BatchFileCreatedEvent
7+
from common.clients import get_s3_client
98
from constants import ACK_BUCKET_NAME, SOURCE_BUCKET_NAME
109

1110

@@ -17,7 +16,7 @@ class BatchFileRepository:
1716
_ACK_BUCKET_NAME: str = ACK_BUCKET_NAME
1817

1918
def __init__(self):
20-
self._s3_client = boto3.client("s3")
19+
self._s3_client = get_s3_client()
2120

2221
@staticmethod
2322
def _create_ack_failure_data(
@@ -38,6 +37,7 @@ def _create_ack_failure_data(
3837
"MESSAGE_DELIVERY": False,
3938
}
4039

40+
# TODO: can refactor to move_file()
4141
def move_source_file_to_archive(self, file_key: str) -> None:
4242
self._s3_client.copy_object(
4343
Bucket=self._SOURCE_BUCKET_NAME,

lambdas/batch_processor_filter/src/batch_processor_filter_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from batch_audit_repository import BatchAuditRepository
88
from batch_file_created_event import BatchFileCreatedEvent
99
from batch_file_repository import BatchFileRepository
10-
from common.clients import logger
10+
from common.clients import logger, get_sqs_client
1111
from common.log_firehose import send_log_to_firehose
1212
from constants import QUEUE_URL, REGION_NAME, FileNotProcessedReason, FileStatus
1313
from exceptions import EventAlreadyProcessingForSupplierAndVaccTypeError
@@ -26,7 +26,7 @@ def __init__(
2626
):
2727
self._batch_audit_repository = audit_repo
2828
self._batch_file_repo = batch_file_repo
29-
self._queue_client = boto3.client("sqs", region_name=REGION_NAME)
29+
self._queue_client = get_sqs_client()
3030

3131
def _is_duplicate_file(self, file_key: str) -> bool:
3232
"""Checks if a file with the same name has already been processed or marked for processing"""

0 commit comments

Comments
 (0)