omserv 0.0.0.dev31__py3-none-any.whl → 0.0.0.dev33__py3-none-any.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.
- omserv/nginx/build.py +2 -2
- omserv/server/multiprocess.py +11 -11
- {omserv-0.0.0.dev31.dist-info → omserv-0.0.0.dev33.dist-info}/METADATA +2 -2
- {omserv-0.0.0.dev31.dist-info → omserv-0.0.0.dev33.dist-info}/RECORD +7 -7
- {omserv-0.0.0.dev31.dist-info → omserv-0.0.0.dev33.dist-info}/LICENSE +0 -0
- {omserv-0.0.0.dev31.dist-info → omserv-0.0.0.dev33.dist-info}/WHEEL +0 -0
- {omserv-0.0.0.dev31.dist-info → omserv-0.0.0.dev33.dist-info}/top_level.txt +0 -0
omserv/nginx/build.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import multiprocessing
|
1
|
+
import multiprocessing as mp
|
2
2
|
import os.path
|
3
3
|
import shutil
|
4
4
|
import subprocess
|
@@ -102,7 +102,7 @@ def build_nginx() -> None:
|
|
102
102
|
|
103
103
|
#
|
104
104
|
|
105
|
-
make_jobs = max(
|
105
|
+
make_jobs = max(mp.cpu_count() // 2, 1)
|
106
106
|
subprocess.check_call([
|
107
107
|
'make',
|
108
108
|
f'-j{make_jobs}',
|
omserv/server/multiprocess.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import functools
|
2
|
-
import multiprocessing
|
2
|
+
import multiprocessing as mp
|
3
3
|
import multiprocessing.connection
|
4
4
|
import multiprocessing.context
|
5
5
|
import multiprocessing.synchronize
|
@@ -20,7 +20,7 @@ from .workers import serve
|
|
20
20
|
|
21
21
|
|
22
22
|
async def check_multiprocess_shutdown_event(
|
23
|
-
shutdown_event:
|
23
|
+
shutdown_event: mp.synchronize.Event,
|
24
24
|
sleep: ta.Callable[[float], ta.Awaitable[ta.Any]],
|
25
25
|
) -> None:
|
26
26
|
while True:
|
@@ -33,7 +33,7 @@ def _multiprocess_serve(
|
|
33
33
|
app: AsgiFramework,
|
34
34
|
config: Config,
|
35
35
|
sockets: Sockets | None = None,
|
36
|
-
shutdown_event:
|
36
|
+
shutdown_event: mp.synchronize.Event | None = None,
|
37
37
|
) -> None:
|
38
38
|
if sockets is not None:
|
39
39
|
for sock in sockets.insecure_sockets:
|
@@ -62,7 +62,7 @@ def serve_multiprocess(
|
|
62
62
|
sockets = create_sockets(config)
|
63
63
|
|
64
64
|
exitcode = 0
|
65
|
-
ctx =
|
65
|
+
ctx = mp.get_context('spawn')
|
66
66
|
|
67
67
|
active = True
|
68
68
|
shutdown_event = ctx.Event()
|
@@ -72,7 +72,7 @@ def serve_multiprocess(
|
|
72
72
|
shutdown_event.set()
|
73
73
|
active = False
|
74
74
|
|
75
|
-
processes: list[
|
75
|
+
processes: list[mp.Process] = []
|
76
76
|
while active:
|
77
77
|
# Ignore SIGINT before creating the processes, so that they inherit the signal handling. This means that the
|
78
78
|
# shutdown function controls the shutdown.
|
@@ -92,7 +92,7 @@ def serve_multiprocess(
|
|
92
92
|
if hasattr(signal, signal_name):
|
93
93
|
signal.signal(getattr(signal, signal_name), shutdown)
|
94
94
|
|
95
|
-
|
95
|
+
mp.connection.wait(process.sentinel for process in processes)
|
96
96
|
|
97
97
|
exitcode = _join_exited(processes)
|
98
98
|
if exitcode != 0:
|
@@ -111,17 +111,17 @@ def serve_multiprocess(
|
|
111
111
|
|
112
112
|
|
113
113
|
def _populate(
|
114
|
-
processes: list[
|
114
|
+
processes: list[mp.Process],
|
115
115
|
app: AsgiFramework,
|
116
116
|
config: Config,
|
117
117
|
worker_func: ta.Callable,
|
118
118
|
sockets: Sockets,
|
119
|
-
shutdown_event:
|
120
|
-
ctx:
|
119
|
+
shutdown_event: mp.synchronize.Event,
|
120
|
+
ctx: mp.context.BaseContext,
|
121
121
|
) -> None:
|
122
122
|
num_workers = config.workers or 1
|
123
123
|
if num_workers < 0:
|
124
|
-
num_workers =
|
124
|
+
num_workers = mp.cpu_count()
|
125
125
|
for _ in range(num_workers - len(processes)):
|
126
126
|
process = ctx.Process( # type: ignore
|
127
127
|
target=worker_func,
|
@@ -145,7 +145,7 @@ def _populate(
|
|
145
145
|
time.sleep(0.1)
|
146
146
|
|
147
147
|
|
148
|
-
def _join_exited(processes: list[
|
148
|
+
def _join_exited(processes: list[mp.Process]) -> int:
|
149
149
|
exitcode = 0
|
150
150
|
for index in reversed(range(len(processes))):
|
151
151
|
worker = processes[index]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: omserv
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.dev33
|
4
4
|
Summary: omserv
|
5
5
|
Author: wrmsr
|
6
6
|
License: BSD-3-Clause
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
12
12
|
Classifier: Operating System :: POSIX
|
13
13
|
Requires-Python: ~=3.12
|
14
14
|
License-File: LICENSE
|
15
|
-
Requires-Dist: omlish ==0.0.0.
|
15
|
+
Requires-Dist: omlish ==0.0.0.dev33
|
16
16
|
Provides-Extra: all
|
17
17
|
Requires-Dist: h11 ~=0.14 ; extra == 'all'
|
18
18
|
Requires-Dist: h2 ~=4.1 ; extra == 'all'
|
@@ -9,7 +9,7 @@ omserv/apps/routes.py,sha256=shcN8qCSF2YoKal7nk-lemCAK3RX8MuHgNHhq_CTnh0,3762
|
|
9
9
|
omserv/apps/sessions.py,sha256=glruQSbOSbCYLPp6nDRNSHCyp5hj4oiOPhh3R0F9BTM,1537
|
10
10
|
omserv/apps/templates.py,sha256=PBRZHIF9UbnFnq-4EC6RmPeRkeH8lCBbpJkSdseHs6A,2125
|
11
11
|
omserv/nginx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
|
-
omserv/nginx/build.py,sha256=
|
12
|
+
omserv/nginx/build.py,sha256=zt7e7Jt4R3Nfq-aosBgChdbK0O85oKIOBJmnupsk27o,3145
|
13
13
|
omserv/nginx/configs.py,sha256=4oQDcKJKIatRG621qiZCYTayJI3-vv63TtRCiUxEVWI,2008
|
14
14
|
omserv/nginx/stubstatus.py,sha256=_VnXZdXxSA7jIelYSwJLf9mOnt_UOvpWghAPWtlWSLw,1857
|
15
15
|
omserv/nginx/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -25,7 +25,7 @@ omserv/server/debug.py,sha256=N7RI0Jj-ttmys3DJD0RREmGG5XZpTCp6y9Yu0x98Agg,299
|
|
25
25
|
omserv/server/events.py,sha256=VMr_rArsVjJYnyH9SqLWtOLUg18vSu1O0ep9gNBGR_c,1369
|
26
26
|
omserv/server/headers.py,sha256=3H-NxMMQg5WuF5wF4AWFUEqkToh4NqNqHouavzbOQok,1188
|
27
27
|
omserv/server/lifespans.py,sha256=kRVxDQM18jCBzRUpafyb69q_bGSCyxxjAtrkxjqcZdE,4607
|
28
|
-
omserv/server/multiprocess.py,sha256=
|
28
|
+
omserv/server/multiprocess.py,sha256=jKmQzj_Nrwxw2mM-Tf3XVf6vPYMbfyCkPOUWVe028Q8,4253
|
29
29
|
omserv/server/sockets.py,sha256=lwqNP7URlp605ibsjHzp0pc-lyjcyTu-hD-uyojLUYk,3389
|
30
30
|
omserv/server/ssl.py,sha256=gmB5ecM8Mck-YtGYF8pb2dwFdjABVGzERFCDzM9lBck,1483
|
31
31
|
omserv/server/taskspawner.py,sha256=ljzF26UPtnp7GLAY_BvjzuwCoCO9aL7TKLwRNTmUy1M,3008
|
@@ -44,8 +44,8 @@ omserv/server/streams/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
44
44
|
omserv/server/streams/httpstream.py,sha256=0DeiAPLGbEGNa0fHTs8lUpi_CFZs4M5_QB-TiS8mobQ,8015
|
45
45
|
omserv/server/streams/utils.py,sha256=aMOrqWIg_Hht5W4kLg3y7oR5AEkVvMrZhyjzo6U5owE,1527
|
46
46
|
omserv/server/streams/wsstream.py,sha256=3Vyzox7dCE1tDSXjb6xBubWo41ZF9d38Hrsrlj6h1J8,15482
|
47
|
-
omserv-0.0.0.
|
48
|
-
omserv-0.0.0.
|
49
|
-
omserv-0.0.0.
|
50
|
-
omserv-0.0.0.
|
51
|
-
omserv-0.0.0.
|
47
|
+
omserv-0.0.0.dev33.dist-info/LICENSE,sha256=B_hVtavaA8zCYDW99DYdcpDLKz1n3BBRjZrcbv8uG8c,1451
|
48
|
+
omserv-0.0.0.dev33.dist-info/METADATA,sha256=Yd-GOaTCgJmuEQAcgSGzh5kzV7sBMzuqU0QiZ_K-lqc,1003
|
49
|
+
omserv-0.0.0.dev33.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
50
|
+
omserv-0.0.0.dev33.dist-info/top_level.txt,sha256=HXehpnxeKscKNULzKNzZ27oNawBrsh1PaNAirbX-XNA,7
|
51
|
+
omserv-0.0.0.dev33.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|