From 90dc8747b8545b69d2decdde7d2494ce1bae658a Mon Sep 17 00:00:00 2001 From: luk0y <45989946+luk0y@users.noreply.github.com> Date: Wed, 19 Aug 2020 11:41:46 +0530 Subject: [PATCH 1/2] Update test_multiprocessing.py --- test_multiprocessing.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test_multiprocessing.py b/test_multiprocessing.py index 21ca9fa..995aefa 100644 --- a/test_multiprocessing.py +++ b/test_multiprocessing.py @@ -11,9 +11,9 @@ def fetch(session, url): with session.get(url) as response: print(response.json()['uuid']) - -@timer(1, 1) -def main(): - with Pool() as pool: - with requests.Session() as session: - pool.starmap(fetch, [(session, URL) for _ in range(100)]) +if __name__ == "__main__": + @timer(1, 1) + def main(): + with Pool() as pool: + with requests.Session() as session: + pool.starmap(fetch, [(session, URL) for _ in range(100)]) From 006289bedb71189d249fafcf5378a0c399730f49 Mon Sep 17 00:00:00 2001 From: luk0y <45989946+luk0y@users.noreply.github.com> Date: Wed, 19 Aug 2020 11:50:13 +0530 Subject: [PATCH 2/2] Update test_multiprocessing.py --- test_multiprocessing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test_multiprocessing.py b/test_multiprocessing.py index 995aefa..5222a23 100644 --- a/test_multiprocessing.py +++ b/test_multiprocessing.py @@ -13,6 +13,7 @@ def fetch(session, url): if __name__ == "__main__": @timer(1, 1) + def main(): with Pool() as pool: with requests.Session() as session: