remove deduplication as default
This commit is contained in:
@@ -31,12 +31,12 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool | No
|
||||
)
|
||||
|
||||
target_month = expires_at.strftime('%Y-%m')
|
||||
now_ = now()
|
||||
pk = f'CERT#REPORTING#ORG#{org_id}'
|
||||
now_ = now(tz)
|
||||
pk = f'CERT_REPORTING#ORG#{org_id}'
|
||||
|
||||
try:
|
||||
if now_ > expires_at:
|
||||
raise InvalidDateError()
|
||||
raise InvalidDateError('Invalid date')
|
||||
|
||||
# The reporting month is the month before the certificate expires
|
||||
report_month = (expires_at.replace(day=1) - timedelta(days=1)).replace(day=1)
|
||||
@@ -52,7 +52,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool | No
|
||||
'created_at': now_,
|
||||
},
|
||||
cond_expr='attribute_not_exists(sk)',
|
||||
exc_cls=ReportingConflictError,
|
||||
exc_cls=ReportExistsError,
|
||||
)
|
||||
transact.put(
|
||||
item={
|
||||
@@ -64,7 +64,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool | No
|
||||
},
|
||||
)
|
||||
except Exception as exc:
|
||||
logger.exception(exc)
|
||||
logger.info(exc)
|
||||
|
||||
try:
|
||||
dyn.put_item(
|
||||
@@ -89,4 +89,6 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool | No
|
||||
class InvalidDateError(Exception): ...
|
||||
|
||||
|
||||
class ReportingConflictError(Exception): ...
|
||||
class ReportExistsError(Exception):
|
||||
def __init__(self, *args: object) -> None:
|
||||
super().__init__('Report already exists')
|
||||
|
||||
Reference in New Issue
Block a user