Skip to content

Commit d54303b

Browse files
authored
[Python] Bump Granian to 1.5.x (TechEmpower#9157)
1 parent 11376ea commit d54303b

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
emmett[orjson]>=2.5.3,<2.6.0
1+
emmett[orjson]>=2.5.12,<2.6.0
22
psycopg2-binary==2.9.5

frameworks/Python/emmett/run.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55

66
if __name__ == "__main__":
7-
cpus = multiprocessing.cpu_count()
7+
workers = round(multiprocessing.cpu_count() / 2)
88

99
run(
1010
"rsgi",
1111
("app", "app"),
1212
host="0.0.0.0",
1313
port=8080,
14-
workers=cpus,
14+
workers=workers,
1515
backlog=16384,
16-
threading_mode='runtime',
16+
threading_mode="runtime",
17+
http="1",
1718
enable_websockets=False,
1819
log_level="warn"
1920
)
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
asyncpg==0.29.0
2-
granian>=1.4.2,<1.5.0
2+
granian>=1.5.1,<1.6.0
33
jinja2==3.1.4
44
orjson==3.10.2

frameworks/Python/granian/run.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@
77
if __name__ == '__main__':
88
interface = sys.argv[1]
99
threading_mode = sys.argv[2]
10-
workers = multiprocessing.cpu_count()
11-
if threading_mode == "workers":
12-
workers = round(workers / 2)
10+
11+
#: split cores between the two loops
12+
workers = round(multiprocessing.cpu_count() / 2)
13+
14+
blocking_threads = None
15+
if interface == "wsgi":
16+
#: we don't run any I/O in WSGI benches
17+
blocking_threads = 1
1318

1419
Granian(
1520
f"app_{interface}:main",
1621
address="0.0.0.0",
1722
port=8080,
1823
workers=workers,
1924
threading_mode=threading_mode,
20-
blocking_threads=1,
25+
blocking_threads=blocking_threads,
2126
backlog=16384,
2227
interface=interface,
2328
http="1",

0 commit comments

Comments
 (0)