Skip to content

Commit

Permalink
Use global threadpool
Browse files Browse the repository at this point in the history
  • Loading branch information
mawandm committed Jul 1, 2024
1 parent 86964d6 commit 7bd1e8e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions nesis/api/core/document_loaders/minio.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def __init__(
self._cache_client = cache_client
self._datasource = datasource

self._worker_executor_pool = BlockingThreadPoolExecutor(max_workers=3)

_extract_runner = None
_ingest_runner = IngestRunner(config=config, http_client=http_client)
if self._datasource.connection.get("destination") is not None:
Expand Down Expand Up @@ -122,7 +120,7 @@ def _sync_documents(

for bucket_object in bucket_objects:
futures.append(
self._worker_executor_pool.submit(
IOBoundPool.submit(
self._process_object,
bucket_name,
client,
Expand Down Expand Up @@ -276,10 +274,6 @@ def _unsync_documents(
except:
_LOG.warn("Error fetching and updating documents", exc_info=True)

def __del__(self) -> None:
logging.info("Closing the worker pool")
self._worker_executor_pool.shutdown(wait=True)


def validate_connection_info(connection: Dict[str, Any]) -> Dict[str, Any]:
_valid_keys = ["endpoint", "user", "password", "dataobjects", "destination", "mode"]
Expand Down

0 comments on commit 7bd1e8e

Please sign in to comment.