Skip to content

Commit 7da0787

Browse files
fix: update emulator client to use correct gRPC endpoint
Co-Authored-By: Rushil Srivastava <[email protected]>
1 parent 05dfb12 commit 7da0787

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fastapi_gcp_tasks/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Third Party Imports
1+
# Standard Library Imports
2+
import os
23
from typing import Any
34

5+
# Third Party Imports
46
import grpc
57
from google.api_core.exceptions import AlreadyExists
68
from google.cloud import scheduler_v1, tasks_v2
@@ -42,8 +44,9 @@ def ensure_queue(
4244
pass
4345

4446

45-
def emulator_client(*, host: str = "localhost:8123") -> tasks_v2.CloudTasksClient:
47+
def emulator_client() -> tasks_v2.CloudTasksClient:
4648
"""Helper function to create a CloudTasksClient from an emulator host."""
49+
host = os.getenv("CLOUD_TASKS_EMULATOR_HOST", "localhost:8124")
4750
channel = grpc.insecure_channel(host)
4851
transport = transports.CloudTasksGrpcTransport(channel=channel)
4952
return tasks_v2.CloudTasksClient(transport=transport)

0 commit comments

Comments
 (0)