Skip to content

Commit 90688df

Browse files
committed
DELTA_TTL_DAYS
1 parent a9b3220 commit 90688df

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

delta_backend/src/delta.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
failure_queue_url = os.environ["AWS_SQS_QUEUE_URL"]
1818
delta_table_name = os.environ["DELTA_TABLE_NAME"]
1919
delta_source = os.environ["SOURCE"]
20-
delta_ttl = os.environ["DELTA_TTL"]
20+
delta_ttl_days = os.environ["DELTA_TTL_DAYS"]
2121
region_name = "eu-west-2"
2222
logging.basicConfig()
2323
logger = logging.getLogger()
@@ -74,7 +74,7 @@ def get_imms_id(primary_key: str) -> str:
7474

7575
def get_creation_and_expiry_times(creation_timestamp: float) -> (str, int):
7676
creation_datetime = datetime.fromtimestamp(creation_timestamp, UTC)
77-
expiry_datetime = creation_datetime + timedelta(days=int(delta_ttl))
77+
expiry_datetime = creation_datetime + timedelta(days=int(delta_ttl_days))
7878
expiry_timestamp = int(expiry_datetime.timestamp())
7979
return creation_datetime.isoformat(), expiry_timestamp
8080

delta_backend/tests/test_convert.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
MOCK_ENV_VARS = {
1414
"AWS_SQS_QUEUE_URL": "https://sqs.eu-west-2.amazonaws.com/123456789012/test-queue",
1515
"DELTA_TABLE_NAME": "immunisation-batch-internal-dev-audit-test-table",
16-
"DELTA_TTL": "14",
16+
"DELTA_TTL_DAYS": "14",
1717
"SOURCE": "test-source",
1818
}
1919
request_json_data = ValuesForTests.json_data
@@ -115,8 +115,8 @@ def assert_dynamodb_record(self, operation_flag, action_flag, items, expected_va
115115
self.assertIn(key, filtered_items[0], f"{key} is missing")
116116
self.assertEqual(filtered_items[0][key], expected_value, f"{key} mismatch")
117117

118-
# Check that the value of ExpiresAt is DELTA_TTL days after DateTimeStamp
119-
expected_seconds = int(os.environ["DELTA_TTL"]) * 24 * 60 * 60
118+
# Check that the value of ExpiresAt is DELTA_TTL_DAYS after DateTimeStamp
119+
expected_seconds = int(os.environ["DELTA_TTL_DAYS"]) * 24 * 60 * 60
120120
date_time = int(datetime.fromisoformat(unfiltered_items[0]["DateTimeStamp"]).timestamp())
121121
expires_at = unfiltered_items[0]["ExpiresAt"]
122122
self.assertEqual(expires_at - date_time, expected_seconds)

delta_backend/tests/test_delta.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
## @TODO: # Note: Environment variables shared across tests, thus aligned
1414
os.environ["AWS_SQS_QUEUE_URL"] = TEST_QUEUE_URL
1515
os.environ["DELTA_TABLE_NAME"] = "my_delta_table"
16-
os.environ["DELTA_TTL"] = "14"
16+
os.environ["DELTA_TTL_DAYS"] = "14"
1717
os.environ["SOURCE"] = "my_source"
1818

1919
from delta import send_message, handler, process_record # Import after setting environment variables

terraform/delta.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ resource "aws_lambda_function" "delta_sync_lambda" {
138138
environment {
139139
variables = {
140140
DELTA_TABLE_NAME = aws_dynamodb_table.delta-dynamodb-table.name
141-
DELTA_TTL = 30
141+
DELTA_TTL_DAYS = 30
142142
AWS_SQS_QUEUE_URL = aws_sqs_queue.dlq.id
143143
SOURCE = "IEDS"
144144
SPLUNK_FIREHOSE_NAME = module.splunk.firehose_stream_name

0 commit comments

Comments
 (0)