Skip to content

Commit 744cd23

Browse files
fix: add additional gRPC channel options for connection stability
Co-Authored-By: Rushil Srivastava <[email protected]>
1 parent 909938a commit 744cd23

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fastapi_gcp_tasks/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ def emulator_client() -> tasks_v2.CloudTasksClient:
4848
"""Helper function to create a CloudTasksClient from an emulator host."""
4949
host = os.getenv("CLOUD_TASKS_EMULATOR_HOST", "localhost")
5050
port = os.getenv("CLOUD_TASKS_EMULATOR_PORT", "8123")
51+
target = f"{host}:{port}"
5152
channel = grpc.insecure_channel(
52-
f"{host}:{port}",
53+
target,
5354
options=[
5455
('grpc.enable_http_proxy', 0),
5556
('grpc.enable_retries', 0),
57+
('grpc.max_receive_message_length', -1),
58+
('grpc.max_send_message_length', -1),
59+
('grpc.keepalive_time_ms', 30000),
5660
],
5761
)
5862
transport = transports.CloudTasksGrpcTransport(channel=channel)

0 commit comments

Comments
 (0)