From 0deb290b05b6be68d40eb750d4eb5a244d6c56d8 Mon Sep 17 00:00:00 2001 From: tzlil Date: Sat, 9 Sep 2023 01:01:35 +0300 Subject: does gunicorn like that --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app.py') 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) -- cgit 1.4.1