summary refs log tree commit diff
diff options
context:
space:
mode:
authortzlil <tzlils@protonmail.com>2023-09-09 01:01:35 +0300
committertzlil <tzlils@protonmail.com>2023-09-09 01:01:35 +0300
commit0deb290b05b6be68d40eb750d4eb5a244d6c56d8 (patch)
tree2bf8bea9f9a77f58479ea71c8cda15a0a8534526
parent3fe6df451f86e8583e89e7866c65558c343d0170 (diff)
does gunicorn like that
-rw-r--r--app.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/app.py b/app.py
index 6c39b58..c60a4bd 100644
--- a/app.py
+++ b/app.py
@@ -11,6 +11,7 @@ from functools import cache
 import feedparser
 import multiprocessing
 
+mp = multiprocessing.get_context('spawn')
 parse = lambda l: bs(urllib.request.urlopen(l), 'html.parser')
 
 @cache
@@ -32,7 +33,7 @@ def get_links(category="cs"):
 def get_probability_distribution(topic):
     links = get_links(topic)
     x = [0, len(links)//2, round(len(links)//1.5), len(links)-2]
-    with multiprocessing.Pool(processes=5) as pool:
+    with mp.Pool(processes=5) as pool:
         ts = pool.map(total, [links[x] for x in x]+[links[-1]])
     y = ts[:-1]
     ly = np.log(y)