def get_recently_sent_alerts(limits):
table = create_or_get_table(
table_name=SENT_ALERTS_TABLE_NAME,
attribute_definitions=[
{
'AttributeName': 'limit_name',
'AttributeType': 'S',
},
],
key_schema=[
{
'AttributeName': 'limit_name',
'KeyType': 'HASH'
},
],
)
three_days_ago_ts = Decimal((datetime.utcnow() - timedelta(days=3)).strftime('%s'))
alerts = table.scan(
FilterExpression=Attr('alert_sent').gt(three_days_ago_ts)
)['Items']
return [alert['limit_name'] for alert in alerts]
评论列表
文章目录