Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Remove timeout from sync watch dir

Jakub Novak6e926ecb136c
diff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
index 7d62cb4d7..b2e7bc9a8 100644
--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
@@ -303,16 +303,14 @@ class Filesystem:
path: str,
user: Username = "user",
request_timeout: Optional[float] = None,
- timeout: Optional[float] = 60,
) -> WatchHandle:
"""
- Watches directory for filesystem events. The watch will be closed after the timeout.
- To get the events, you need to iterate over the returned WatchHandle.
+ Watches directory for filesystem events.
+ To get events, use the `get_new_events` method on the returned handle.
:param path: Path to a directory that will be watched
:param user: Run the operation as this user
:param request_timeout: Timeout for the request
- :param timeout: Timeout for the watch, after which the watch will be closed
:return: Watcher handle
"""
try:
@@ -321,7 +319,6 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- timeout=timeout,
headers={
**authentication_header(user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
diff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/watch_handle.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/watch_handle.py
index 483272e5e..bd3a0b3be 100644
--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/watch_handle.py
+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/watch_handle.py
@@ -23,7 +23,7 @@ class WatchHandle:
def stop(self):
"""
- Stop watching the directory. After you close the watcher you won't be able to get the events anymore.
+ Stop watching the directory. After you stop the watcher you won't be able to get the events anymore.
"""
try:
self._rpc.watch_dir_stop(WatchDirStopRequest(watcher_id=self._watcher_id))
@@ -37,7 +37,7 @@ class WatchHandle:
Get the latest events that have occurred in the watched directory since the last call, or from the beginning of the watching, up to now.
"""
if self._closed:
- raise SandboxException("The watcher is already closed")
+ raise SandboxException("The watcher is already stopped")
try:
r = self._rpc.watch_dir_get(WatchDirGetRequest(watcher_id=self._watcher_id))