From fd3c0a6dc4aaefb35798959c15a0a46697a5f85d Mon Sep 17 00:00:00 2001 From: tech234a <46801700+tech234a@users.noreply.github.com> Date: Fri, 25 Sep 2020 16:46:42 -0400 Subject: [PATCH] Install aioquic on Heroku if not installed at deploy-time --- worker.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/worker.py b/worker.py index 16cd5c4..1da1909 100644 --- a/worker.py +++ b/worker.py @@ -5,6 +5,16 @@ from os import mkdir, rmdir, listdir, system, environ from os.path import isdir, isfile, getsize from json import dumps, loads +HEROKU = False +if isfile("../Procfile") and isfile("../requirements.txt"): + print("Heroku detected... using 20 threads instead of 50.") + HEROKU = True + +if HEROKU: + if not "aioquic" in open("../requirements.txt").read(): + print("Installing aioquic on this Heroku instance since it wasn't installed on deploy...") + system("pip install --user aioquic") + import signal import tracker @@ -33,10 +43,6 @@ try: except: pass -HEROKU = False -if isfile("../Procfile"): - HEROKU = True - langs = ['ab', 'aa', 'af', 'sq', 'ase', 'am', 'ar', 'arc', 'hy', 'as', 'ay', 'az', 'bn', 'ba', 'eu', 'be', 'bh', 'bi', 'bs', 'br', 'bg', 'yue', 'yue-HK', 'ca', 'chr', 'zh-CN', 'zh-HK', 'zh-Hans', 'zh-SG', 'zh-TW', 'zh-Hant', 'cho', 'co', 'hr', 'cs', 'da', 'nl', 'nl-BE', 'nl-NL', 'dz', 'en', 'en-CA', 'en-IN', 'en-IE', 'en-GB', 'en-US', 'eo', 'et', 'fo', 'fj', 'fil', 'fi', 'fr', 'fr-BE',