Skip to content

Commit 1c7b9ea

Browse files
committed
added cloud tasks queue for refresh materialized view
1 parent 0b4929e commit 1c7b9ea

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

infra/functions-python/main.tf

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ resource "google_cloudfunctions2_function" "reverse_geolocation_populate" {
968968
environment_variables = {
969969
PYTHONNODEBUGRANGES = 0
970970
DB_REUSE_SESSION = "True"
971-
GOOGLE_FUNCTION_SOURCE = "src/main.py"
972971
}
973972
available_memory = local.function_reverse_geolocation_populate_config.available_memory
974973
timeout_seconds = local.function_reverse_geolocation_populate_config.timeout
@@ -1243,7 +1242,6 @@ resource "google_cloudfunctions2_function" "tasks_executor" {
12431242
PROJECT_ID = var.project_id
12441243
ENV = var.environment
12451244
PUBSUB_TOPIC_NAME = "rebuild-bounding-boxes-topic"
1246-
GOOGLE_FUNCTION_SOURCE = "src/main.py"
12471245
}
12481246
available_memory = local.function_tasks_executor_config.memory
12491247
timeout_seconds = local.function_tasks_executor_config.timeout
@@ -1421,6 +1419,26 @@ resource "google_cloud_tasks_queue" "update_validation_report_task_queue" {
14211419
}
14221420
}
14231421

1422+
# Task queue to invoke refresh_materialized_view function
1423+
resource "google_cloud_tasks_queue" "refresh_materialized_view_task_queue" {
1424+
project = var.project_id
1425+
location = var.gcp_region
1426+
name = "refresh-materialized-view-task-queue"
1427+
1428+
rate_limits {
1429+
max_concurrent_dispatches = 2
1430+
max_dispatches_per_second = 0.5
1431+
}
1432+
1433+
retry_config {
1434+
# This will make the cloud task retry for ~30 minutes
1435+
max_attempts = 31
1436+
min_backoff = "120s"
1437+
max_backoff = "120s"
1438+
max_doublings = 2
1439+
}
1440+
}
1441+
14241442
# Task queue to invoke gbfs_validator_batch function for the scheduler
14251443
resource "google_cloudfunctions2_function_iam_member" "gbfs_validator_batch_invoker" {
14261444
project = var.project_id

0 commit comments

Comments
 (0)