cocoindex 0.2.0__cp311-cp311-win_amd64.whl → 0.2.1__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
cocoindex/setting.py CHANGED
@@ -44,8 +44,8 @@ class DatabaseConnectionSpec:
44
44
  url: str
45
45
  user: str | None = None
46
46
  password: str | None = None
47
- max_connections: int = 64
48
- min_connections: int = 16
47
+ max_connections: int = 25
48
+ min_connections: int = 5
49
49
 
50
50
 
51
51
  @dataclass
@@ -22,6 +22,7 @@ import time
22
22
  from .user_app_loader import load_user_app
23
23
  from .runtime import execution_context
24
24
  import logging
25
+ import multiprocessing as mp
25
26
 
26
27
  WATCHDOG_INTERVAL_SECONDS = 10.0
27
28
 
@@ -43,6 +44,7 @@ def _get_pool() -> ProcessPoolExecutor:
43
44
  max_workers=1,
44
45
  initializer=_subprocess_init,
45
46
  initargs=(_user_apps, os.getpid()),
47
+ mp_context=mp.get_context("spawn"),
46
48
  )
47
49
  return _pool
48
50
 
@@ -69,6 +71,7 @@ def _restart_pool(old_pool: ProcessPoolExecutor | None = None) -> None:
69
71
  max_workers=1,
70
72
  initializer=_subprocess_init,
71
73
  initargs=(_user_apps, os.getpid()),
74
+ mp_context=mp.get_context("spawn"),
72
75
  )
73
76
  if prev_pool is not None:
74
77
  # Best-effort shutdown of previous pool; letting exceptions bubble up
@@ -124,8 +127,19 @@ def _start_parent_watchdog(
124
127
 
125
128
  def _subprocess_init(user_apps: list[str], parent_pid: int) -> None:
126
129
  _start_parent_watchdog(parent_pid)
130
+
131
+ # In case any user app is already in this subprocess, e.g. the subprocess is forked, we need to avoid loading it again.
132
+ with _pool_lock:
133
+ already_loaded_apps = set(_user_apps)
134
+
135
+ loaded_apps = []
127
136
  for app_target in user_apps:
128
- load_user_app(app_target)
137
+ if app_target not in already_loaded_apps:
138
+ load_user_app(app_target)
139
+ loaded_apps.append(app_target)
140
+
141
+ with _pool_lock:
142
+ _user_apps.extend(loaded_apps)
129
143
 
130
144
 
131
145
  class _OnceResult:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Requires-Dist: click>=8.1.8
5
5
  Requires-Dist: rich>=14.0.0
6
6
  Requires-Dist: python-dotenv>=1.1.0
@@ -1,9 +1,9 @@
1
- cocoindex-0.2.0.dist-info/METADATA,sha256=u3xlaek3vJchi1ki3C0wm03J9SNiifOMK6WFmquDvwI,12403
2
- cocoindex-0.2.0.dist-info/WHEEL,sha256=YCZ9Vxhf2aXNyfoR2QH-PPqnUr48Igr9zjgnGhp3xTc,96
3
- cocoindex-0.2.0.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
- cocoindex-0.2.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
1
+ cocoindex-0.2.1.dist-info/METADATA,sha256=m9RVQtYVruDkXdRHm0GdTqZYRSnNF5R_bBIcUqZoIC8,12403
2
+ cocoindex-0.2.1.dist-info/WHEEL,sha256=YCZ9Vxhf2aXNyfoR2QH-PPqnUr48Igr9zjgnGhp3xTc,96
3
+ cocoindex-0.2.1.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
4
+ cocoindex-0.2.1.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
5
5
  cocoindex/__init__.py,sha256=5zwuS_X-n7QAE5uBSufqXp77OW8KVVD8E5t_6koDLRc,2293
6
- cocoindex/_engine.cp311-win_amd64.pyd,sha256=1LGFH-6e6LSq3FGnX485cYD8sN4r_VRM-cJcU720mnY,71594496
6
+ cocoindex/_engine.cp311-win_amd64.pyd,sha256=XkghipMO0n2h-kyc1_VM5jaIgohCsHF3Q4r2EAXHM1Y,71595008
7
7
  cocoindex/auth_registry.py,sha256=Qq1IVZb-7K4luRrQSDlOPbISnGEZ4kIDsrCU8H2ARw0,1529
8
8
  cocoindex/cli.py,sha256=VgeVgO5z2l6tv7XWS3q-sRZ8cYe9r7izUYUR3NfdgJA,21372
9
9
  cocoindex/convert.py,sha256=k1NT3VoERVS2HV1rLDFyCk6rG1YgHXDnIvrI-lqFdUE,22681
@@ -15,10 +15,10 @@ cocoindex/llm.py,sha256=JM5EPup7FZojynCI0rg4gnMBYmdPZpaHJbVBz3f7BAI,897
15
15
  cocoindex/op.py,sha256=1uOwE1zzMs7FrMSpQMJPUI8YtnXXk3-tlEJ_ahPFq5A,22884
16
16
  cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  cocoindex/runtime.py,sha256=6mE-jR1Kh5c4GETDvBgwjXZq69TK5rh1qNpaseRDZnw,1117
18
- cocoindex/setting.py,sha256=048VfKRly9TzLElJlL01tUxySGtRbsc9m68yIHvMzMU,5464
18
+ cocoindex/setting.py,sha256=obq1EiFlSJvidQZPVVC9V5ZUZAzYnyYcSm_6XUVDkUE,5463
19
19
  cocoindex/setup.py,sha256=KbJvmeFu0NbeoH-5iDmHZP86f26HIId8kHmGUNZAePI,3160
20
20
  cocoindex/sources.py,sha256=mVZhyVTyHzFy7z3lceYqgguygADQkIL42nYK6zKSKKQ,2868
21
- cocoindex/subprocess_exec.py,sha256=KDV7xdFUhKYqHZdiJqirNTl7DbJQUXLvga0Q1urE6XA,8143
21
+ cocoindex/subprocess_exec.py,sha256=ase_F4ivmyShCIJcygRl9Uz8BKthpOLq-TUfyqrUB9A,8658
22
22
  cocoindex/targets.py,sha256=7FfG9kuEf5KTXtLwXMFaPFIut3PsIbpb3XIEjjeF7Bg,2931
23
23
  cocoindex/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  cocoindex/tests/test_convert.py,sha256=kngLt9p2BXo3D7_OZNnnSS1w_Ew8966IuaDpHcfd9Go,51750
@@ -30,4 +30,4 @@ cocoindex/typing.py,sha256=bkKcp4G_xQODwQn92sfeNi-kXSWnbtlwTpFbrMGCnj4,14673
30
30
  cocoindex/user_app_loader.py,sha256=jKNyCq5Osl4dMevlDNloGuwCfDscxw5o0m9_OqrHDN8,1965
31
31
  cocoindex/utils.py,sha256=U3W39zD2uZpXX8v84tJD7sRmbC5ar3z_ljAP1cJrYXI,618
32
32
  cocoindex/validation.py,sha256=4ZjsW-SZT8X_TEEhEE6QG6D-8Oq_TkPAhTqP0mdFYSE,3194
33
- cocoindex-0.2.0.dist-info/RECORD,,
33
+ cocoindex-0.2.1.dist-info/RECORD,,