File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1010@idempotent (persistence_store = persistence_layer )
1111def lambda_handler (event , context ):
1212
13- time .sleep (10 )
13+ time .sleep (5 )
1414
1515 return event
Original file line number Diff line number Diff line change 55
66TABLE_NAME = os .getenv ("IdempotencyTable" , "" )
77persistence_layer = DynamoDBPersistenceLayer (table_name = TABLE_NAME )
8- config = IdempotencyConfig (expires_after_seconds = 20 )
8+ config = IdempotencyConfig (expires_after_seconds = 5 )
99
1010
1111@idempotent (config = config , persistence_store = persistence_layer )
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def idempotency_table_name(infrastructure: dict) -> str:
2929
3030def test_ttl_caching_expiration_idempotency (ttl_cache_expiration_handler_fn_arn : str ):
3131 # GIVEN
32- payload = json .dumps ({"message" : "Lambda Powertools - TTL 20s " })
32+ payload = json .dumps ({"message" : "Lambda Powertools - TTL 5s " })
3333
3434 # WHEN
3535 # first execution
@@ -44,8 +44,8 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
4444 )
4545 second_execution_response = second_execution ["Payload" ].read ().decode ("utf-8" )
4646
47- # wait 20s to expire ttl and execute again, this should return a new response value
48- sleep (20 )
47+ # wait 8s to expire ttl and execute again, this should return a new response value
48+ sleep (8 )
4949 third_execution , _ = data_fetcher .get_lambda_response (
5050 lambda_arn = ttl_cache_expiration_handler_fn_arn , payload = payload
5151 )
@@ -58,7 +58,7 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
5858
5959def test_ttl_caching_timeout_idempotency (ttl_cache_timeout_handler_fn_arn : str ):
6060 # GIVEN
61- payload_timeout_execution = json .dumps ({"sleep" : 10 , "message" : "Lambda Powertools - TTL 1s" })
61+ payload_timeout_execution = json .dumps ({"sleep" : 5 , "message" : "Lambda Powertools - TTL 1s" })
6262 payload_working_execution = json .dumps ({"sleep" : 0 , "message" : "Lambda Powertools - TTL 1s" })
6363
6464 # WHEN
You can’t perform that action at this time.
0 commit comments