File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 10
10
@idempotent (persistence_store = persistence_layer )
11
11
def lambda_handler (event , context ):
12
12
13
- time .sleep (10 )
13
+ time .sleep (5 )
14
14
15
15
return event
Original file line number Diff line number Diff line change 5
5
6
6
TABLE_NAME = os .getenv ("IdempotencyTable" , "" )
7
7
persistence_layer = DynamoDBPersistenceLayer (table_name = TABLE_NAME )
8
- config = IdempotencyConfig (expires_after_seconds = 20 )
8
+ config = IdempotencyConfig (expires_after_seconds = 5 )
9
9
10
10
11
11
@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:
29
29
30
30
def test_ttl_caching_expiration_idempotency (ttl_cache_expiration_handler_fn_arn : str ):
31
31
# GIVEN
32
- payload = json .dumps ({"message" : "Lambda Powertools - TTL 20s " })
32
+ payload = json .dumps ({"message" : "Lambda Powertools - TTL 5s " })
33
33
34
34
# WHEN
35
35
# first execution
@@ -44,8 +44,8 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
44
44
)
45
45
second_execution_response = second_execution ["Payload" ].read ().decode ("utf-8" )
46
46
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 )
49
49
third_execution , _ = data_fetcher .get_lambda_response (
50
50
lambda_arn = ttl_cache_expiration_handler_fn_arn , payload = payload
51
51
)
@@ -58,7 +58,7 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
58
58
59
59
def test_ttl_caching_timeout_idempotency (ttl_cache_timeout_handler_fn_arn : str ):
60
60
# 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" })
62
62
payload_working_execution = json .dumps ({"sleep" : 0 , "message" : "Lambda Powertools - TTL 1s" })
63
63
64
64
# WHEN
You can’t perform that action at this time.
0 commit comments