Skip to content

Commit

Permalink
fix: lambda fine tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
notdodo committed Sep 21, 2024
1 parent de0fce1 commit 7267c26
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pulumi/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""An AWS Python Pulumi program"""

import pulumi
from pulumi_aws import (
apigatewayv2,
cloudwatch,
Expand All @@ -12,10 +11,14 @@
secretsmanager,
)

import pulumi
from lambda_utils import create_lambda_layer, create_lambda_zip
from telegram_provider import Webhook

RESOURCES_PREFIX = "erfiume"

Check failure on line 18 in pulumi/__main__.py

View workflow job for this annotation

GitHub Actions / python-ci-pulumi / install-and-checks

Ruff (I001)

__main__.py:3:1: I001 Import block is un-sorted or un-formatted
SYNC_MINUTES_RATE_NORMAL = 24 * 60 # Once a day
SYNC_MINUTES_RATE_EMERGENCY = 20
EMERGENCY = False

stazioni_table = dynamodb.Table(
f"{RESOURCES_PREFIX}-stazioni",
Expand Down Expand Up @@ -143,7 +146,8 @@
"ENVIRONMENT": pulumi.get_stack(),
},
},
timeout=60,
memory_size=1024,
timeout=50,
)

bot_lambda = lambda_.Function(
Expand All @@ -160,7 +164,8 @@
"ENVIRONMENT": pulumi.get_stack(),
},
},
timeout=15,
memory_size=1024,
timeout=10,
)

scheduler.Schedule(
Expand All @@ -170,7 +175,7 @@
mode="FLEXIBLE",
maximum_window_in_minutes=5,
),
schedule_expression="rate(25 minutes)",
schedule_expression=f"rate({SYNC_MINUTES_RATE_EMERGENCY if EMERGENCY else SYNC_MINUTES_RATE_NORMAL} minutes)",
schedule_expression_timezone="Europe/Rome",
target=scheduler.ScheduleTargetArgs(
arn=fetcher_lambda.arn,
Expand Down Expand Up @@ -222,13 +227,13 @@
f"{RESOURCES_PREFIX}-fetcher",
log_group_class="STANDARD",
name="/aws/lambda/erfiume-fetcher",
retention_in_days=60,
retention_in_days=14,
)
cloudwatch.LogGroup(
f"{RESOURCES_PREFIX}-bot",
log_group_class="STANDARD",
name="/aws/lambda/erfiume-bot",
retention_in_days=60,
retention_in_days=14,
)

if pulumi.get_stack() == "production":
Expand Down

0 comments on commit 7267c26

Please sign in to comment.