Skip to content

Commit

Permalink
Align keepalive on client with proxies and envd
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentaTomas committed Sep 11, 2024
1 parent bc129ca commit a4991a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/python-sdk/e2b/sandbox/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SandboxSetup(ABC):
_limits = Limits(
max_keepalive_connections=10,
max_connections=20,
keepalive_expiry=600,
keepalive_expiry=540,
)

envd_port = 49983
Expand Down
17 changes: 12 additions & 5 deletions packages/python-sdk/e2b/sandbox_sync/sandbox_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class SandboxApi(SandboxApiBase):

@classmethod
def list(
cls,
Expand All @@ -33,7 +32,9 @@ def list(
request_timeout=request_timeout,
)

with ApiClient(config, transport=HTTPTransport(limits=SandboxApiBase._limits)) as api_client:
with ApiClient(
config, transport=HTTPTransport(limits=SandboxApiBase._limits)
) as api_client:
res = get_sandboxes.sync_detailed(
client=api_client,
)
Expand Down Expand Up @@ -79,7 +80,9 @@ def _cls_kill(
if config.debug:
return True

with ApiClient(config, transport=HTTPTransport(limits=SandboxApiBase._limits)) as api_client:
with ApiClient(
config, transport=HTTPTransport(limits=SandboxApiBase._limits)
) as api_client:
res = delete_sandboxes_sandbox_id.sync_detailed(
sandbox_id,
client=api_client,
Expand Down Expand Up @@ -110,7 +113,9 @@ def _cls_set_timeout(
request_timeout=request_timeout,
)

with ApiClient(config, transport=HTTPTransport(limits=SandboxApiBase._limits)) as api_client:
with ApiClient(
config, transport=HTTPTransport(limits=SandboxApiBase._limits)
) as api_client:
res = post_sandboxes_sandbox_id_timeout.sync_detailed(
sandbox_id,
client=api_client,
Expand Down Expand Up @@ -139,7 +144,9 @@ def _create_sandbox(
request_timeout=request_timeout,
)

with ApiClient(config, transport=HTTPTransport(limits=SandboxApiBase._limits)) as api_client:
with ApiClient(
config, transport=HTTPTransport(limits=SandboxApiBase._limits)
) as api_client:
res = post_sandboxes.sync_detailed(
body=NewSandbox(
template_id=template,
Expand Down

0 comments on commit a4991a2

Please sign in to comment.