Skip to content

Commit 96ee32b

Browse files
authored
VED-1059 Made adjustment to batch queueing logic (#1189)
1 parent e135fdf commit 96ee32b

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

infrastructure/instance/kinesis_config.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Define the Kinesis Data Stream resource with 15 shards
21
resource "aws_kinesis_stream" "processor_data_streams" {
32
name = "${local.short_prefix}-processingdata-stream"
43
stream_mode_details {
54
stream_mode = "ON_DEMAND"
65
}
7-
encryption_type = "KMS"
8-
kms_key_id = data.aws_kms_key.existing_kinesis_encryption_key.arn
6+
7+
retention_period = var.environment == "prod" ? 24 * 7 : 24
8+
encryption_type = "KMS"
9+
kms_key_id = data.aws_kms_key.existing_kinesis_encryption_key.arn
910
}
1011

1112
locals {

lambdas/batch_processor_filter/src/batch_audit_repository.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ class BatchAuditRepository:
1717
| Key(AuditTableKeys.STATUS).eq(FileStatus.PREPROCESSED)
1818
| Key(AuditTableKeys.STATUS).eq(FileStatus.PROCESSING)
1919
)
20-
_PROCESSING_AND_FAILED_STATUSES = {FileStatus.PROCESSING, FileStatus.FAILED}
20+
# VED-1059: Record Forwarder Lambda consumes from the Kinesis stream at a slower rate than events come in. So there
21+
# are negligible gains in starting the next file once preprocessing is complete. Hence, why we also include
22+
# FileStatus.PREPROCESSED in this list and wait until a file is fully processed before picking up the next.
23+
_PROCESSING_AND_FAILED_STATUSES = {FileStatus.PROCESSING, FileStatus.PREPROCESSED, FileStatus.FAILED}
2124

2225
def __init__(self):
2326
self._batch_audit_table = get_dynamodb_table(AUDIT_TABLE_NAME)

lambdas/batch_processor_filter/tests/test_lambda_handler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ def test_lambda_handler_raises_error_when_event_already_processing_for_supplier_
203203
"Event is already being processed for supplier + vacc type queue",
204204
FileStatus.PROCESSING,
205205
),
206+
(
207+
"Event is already processing (preprocessed status) for supplier + vacc type queue",
208+
FileStatus.PREPROCESSED,
209+
),
206210
(
207211
"There is a failed event to be checked in supplier + vacc type queue",
208212
FileStatus.FAILED,

0 commit comments

Comments
 (0)