mirror of
https://github.com/MikroWizard/mikrofront.git
synced 2025-06-23 11:08:32 +02:00
Fix High memmory usage problem due to running multiple updater proccess
This commit is contained in:
parent
cfbffe1f64
commit
5ab8c5f10a
3 changed files with 14 additions and 2 deletions
|
@ -15,8 +15,12 @@ import zipfile
|
|||
import subprocess
|
||||
import json
|
||||
from cryptography.fernet import Fernet
|
||||
import psutil
|
||||
import sys
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
|
||||
log = logging.getLogger("updater")
|
||||
log.setLevel(logging.INFO)
|
||||
API_URL="http://host.docker.internal:8181"
|
||||
|
@ -116,6 +120,13 @@ def get_version_from_file():
|
|||
|
||||
def main():
|
||||
while True:
|
||||
pcount=0
|
||||
for process in psutil.process_iter():
|
||||
if '/front-update.py' in process.cmdline():
|
||||
pcount=pcount+1
|
||||
if pcount>=2:
|
||||
print("Already running")
|
||||
exit()
|
||||
try:
|
||||
next_hour = (time.time() // 3600 + 1) * 3600
|
||||
sleep_time = next_hour - time.time()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue