wip
This commit is contained in:
@@ -6,6 +6,7 @@ from aws_lambda_powertools.utilities.data_classes import (
|
||||
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||
from layercake.dateutils import now
|
||||
from layercake.dynamodb import (
|
||||
ComposeKey,
|
||||
DynamoDBPersistenceLayer,
|
||||
KeyPair,
|
||||
)
|
||||
@@ -41,7 +42,23 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
)
|
||||
except Exception:
|
||||
logger.info('Failed to update status to EXPIRED', order_id=new_image['id'])
|
||||
order_layer.put_item(
|
||||
item={
|
||||
'id': new_image['id'],
|
||||
'sk': ComposeKey('failed', prefix=new_image['sk']),
|
||||
'created_at': now_,
|
||||
}
|
||||
)
|
||||
|
||||
return False
|
||||
else:
|
||||
logger.info('Status set to EXPIRED', order_id=new_image['id'])
|
||||
order_layer.put_item(
|
||||
item={
|
||||
'id': new_image['id'],
|
||||
'sk': ComposeKey('completed', prefix=new_image['sk']),
|
||||
'created_at': now_,
|
||||
}
|
||||
)
|
||||
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user