cocoindex 0.2.0__cp313-cp313-macosx_10_12_x86_64.whl → 0.2.1__cp313-cp313-macosx_10_12_x86_64.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=UqU2UILgJFn7J42_8ohdY0MOewTw4X5l_rmmclMP6kM,12187
2
- cocoindex-0.2.0.dist-info/WHEEL,sha256=iXfRWk7-127zCPB-_BNFDQE-qLd9Rsj-fJMRKNRg-kg,106
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=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1
+ cocoindex-0.2.1.dist-info/METADATA,sha256=YjOsHGGJpjD5ioS_7bQkhkVBCmgEFH2NwFxu24PAY24,12187
2
+ cocoindex-0.2.1.dist-info/WHEEL,sha256=iXfRWk7-127zCPB-_BNFDQE-qLd9Rsj-fJMRKNRg-kg,106
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=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
5
5
  cocoindex/__init__.py,sha256=sLpSVO5Cotgn_82lawxvXnaqfa-qj33rytWBAe2MTtU,2201
6
- cocoindex/_engine.cpython-313-darwin.so,sha256=kg6EHfT1E6POzhNdToBDS42lHPIfrCrRK1KHwqm4Qjs,68876620
6
+ cocoindex/_engine.cpython-313-darwin.so,sha256=StMx6yCzG55q9ovrRzN_GiYKF3_ct-D31LSW5vpn6y0,68880564
7
7
  cocoindex/auth_registry.py,sha256=PE1-kVkcyC1G2C_V7b1kvYzeq73OFQehWKQP7ln7fJ8,1478
8
8
  cocoindex/cli.py,sha256=8Q2D0gI_yHorxfFC7tzV96oJAR7PtTn_T4qWLorPPoM,20675
9
9
  cocoindex/convert.py,sha256=x3eYx-NQD-z9h-jmpVgUMiSTqll6Baa_SfZJF3mZSUc,22071
@@ -15,10 +15,10 @@ cocoindex/llm.py,sha256=Pv_cdnRngTLtuLU9AUmS8izIHhcKVnuBNolC33f9BDI,851
15
15
  cocoindex/op.py,sha256=w9CnrCEE6P5Voo2LDvMDlYPrBQuzNC5FfOHP6WF0Buw,22241
16
16
  cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  cocoindex/runtime.py,sha256=povilB3HH3y1JF-yxKwU-pD8n2WnAqyQxIgvXXHNc60,1080
18
- cocoindex/setting.py,sha256=n5ipJ_uMFZBh5-Ib_gyjOqS_XPXsQwTFVYEuSAnoscg,5283
18
+ cocoindex/setting.py,sha256=cuudZ2uJvS48wh-rDToPAUN7-KMjlyQ-0hWhkHMIx4U,5282
19
19
  cocoindex/setup.py,sha256=7uIHKN4FOCuoidPXcKyGTrkqpkl9luL49-6UcnMxYzw,3068
20
20
  cocoindex/sources.py,sha256=o57FZARXaLKuQr4nKYLj9kxXBRX3cWEfDhFG3lldxoE,2779
21
- cocoindex/subprocess_exec.py,sha256=davnBvbw119NBaFX6s9IyHW9MTZyrYYuKYex0HManHY,7902
21
+ cocoindex/subprocess_exec.py,sha256=qSyImpHdvkyQ7HVJPZ3L0IhJWgPARZQjCR0gXdDx-hs,8403
22
22
  cocoindex/targets.py,sha256=Nfh_tpFd1goTnS_cxBjIs4j9zl3Z4Z1JomAQ1dl3Sic,2796
23
23
  cocoindex/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  cocoindex/tests/test_convert.py,sha256=UsQDuz7qukT9UAU5LBv3atNTqdUVc6uW8lrmLA7ys_w,50207
@@ -30,4 +30,4 @@ cocoindex/typing.py,sha256=lEQYIzAGVKQp6RnhyeopY9Q7xEED7yQj3ZMxvTPblV8,14200
30
30
  cocoindex/user_app_loader.py,sha256=o2n25y7CGw9Qrb-RN6tiNlv2YJ9YLM8NSMhJZjLhhKQ,1914
31
31
  cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
32
32
  cocoindex/validation.py,sha256=PZnJoby4sLbsmPv9fOjOQXuefjfZ7gmtsiTGU8SH-tc,3090
33
- cocoindex-0.2.0.dist-info/RECORD,,
33
+ cocoindex-0.2.1.dist-info/RECORD,,