From 435429f49520871c9209cd4da9a9ef051658b2c7 Mon Sep 17 00:00:00 2001 From: Marcin Ulikowski Date: Tue, 16 Jan 2024 21:29:27 +0100 Subject: [PATCH] Removed memory limit --- webapp/webapp.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/webapp/webapp.py b/webapp/webapp.py index 08aa3d4..69f2852 100755 --- a/webapp/webapp.py +++ b/webapp/webapp.py @@ -23,24 +23,15 @@ import time import threading from flask import Flask, request, jsonify, send_from_directory -import resource import dnstwist -def human_to_bytes(size): - units = {'b': 1, 'k': 2**10, 'm': 2**20, 'g': 2**30} - u = size[-1].lower() - if u.isdigit(): - return int(size) - return int(size[:-1]) * units.get(u, 1) - PORT = int(os.environ.get('PORT', 8000)) HOST= os.environ.get('HOST', '127.0.0.1') THREADS = int(os.environ.get('THREADS', dnstwist.THREAD_COUNT_DEFAULT)) NAMESERVERS = os.environ.get('NAMESERVERS') or os.environ.get('NAMESERVER') SESSION_TTL = int(os.environ.get('SESSION_TTL', 3600)) SESSION_MAX = int(os.environ.get('SESSION_MAX', 10)) # max concurrent sessions -MEMORY_LIMIT = human_to_bytes(os.environ.get('MEMORY_LIMIT', '0')) DOMAIN_MAXLEN = int(os.environ.get('DOMAIN_MAXLEN', 15)) WEBAPP_HTML = os.environ.get('WEBAPP_HTML', 'webapp.html') WEBAPP_DIR = os.environ.get('WEBAPP_DIR', os.path.dirname(os.path.abspath(__file__))) @@ -65,10 +56,6 @@ def janitor(sessions): if (s.timestamp + SESSION_TTL) < time.time(): sessions.remove(s) continue - if MEMORY_LIMIT: - maxrss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss * 1024 - if not s.threads and maxrss > MEMORY_LIMIT: - sessions.remove(s) class Session(): def __init__(self, url, nameservers=None, thread_count=THREADS):