Skip to content

Commit

Permalink
fix: lambda fine tuning (#19)
Browse files Browse the repository at this point in the history
* fix: lambda fine tuning

* fix: lint
  • Loading branch information
notdodo authored Sep 21, 2024
1 parent de0fce1 commit df00b7c
Showing 1 changed file with 10 additions and 5 deletions.
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

0 comments on commit df00b7c

Please sign in to comment.