Selaa lähdekoodia

Workaround for Heroku

http3
tech234a 3 vuotta sitten
vanhempi
commit
7be6fa8c7d
2 muutettua tiedostoa jossa 17 lisäystä ja 21 poistoa
  1. +0
    -15
      http3.py
  2. +17
    -6
      worker.py

+ 0
- 15
http3.py Näytä tiedosto

@@ -1,18 +1,3 @@
from os import system
from os.path import isfile
from time import sleep
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("python3 -m pip install --user aioquic")

sleep(5)

import asyncio
from typing import cast
from urllib.parse import urlparse


+ 17
- 6
worker.py Näytä tiedosto

@@ -1,15 +1,26 @@
from threading import Thread
import requests
from time import sleep
from os import mkdir, rmdir, listdir, system, environ
from os.path import isdir, isfile, getsize
from json import dumps, loads
from os import system
from os.path import isfile
from sys import exit

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("python3 -m pip install --user aioquic")
system("python3 worker.py")
exit(0)

from threading import Thread
import requests
from time import sleep
from os import mkdir, rmdir, listdir, environ
from os.path import isdir, getsize
from json import dumps, loads

import signal

import tracker


Ladataan…
Peruuta
Tallenna