Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lambda fine tuning #19

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions pulumi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
from telegram_provider import Webhook

RESOURCES_PREFIX = "erfiume"
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
Loading