Skip to content

Commit

Permalink
Merge pull request #172 from SelfhostedPro/updating
Browse files Browse the repository at this point in the history
added proxy read timeout
  • Loading branch information
SelfhostedPro authored Oct 16, 2020
2 parents 5842033 + 6139a27 commit 0849d98
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion backend/api/actions/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from fastapi import HTTPException
from ..db import models, schemas
from ..utils import *
from ..utils import check_updates as _update_check

from datetime import datetime
import time
Expand Down Expand Up @@ -30,7 +31,7 @@ def check_app_updates():
apps = dclient.containers.list(all=True)
for app in apps:
if app.attrs["Config"]["Image"]:
if check_updates(app.attrs["Config"]["Image"]):
if _update_check(app.attrs["Config"]["Image"]):
apps_list.append(app.name)
return apps_list

Expand Down
5 changes: 4 additions & 1 deletion backend/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,10 @@ async def websocket_auth(websocket: WebSocket):


async def calculate_cpu_percent(d):
cpu_count = len(d["cpu_stats"]["cpu_usage"]["percpu_usage"])
try:
cpu_count = len(d["cpu_stats"]["cpu_usage"]["percpu_usage"])
except KeyError as exc:
pass
cpu_percent = 0.0
cpu_delta = float(d["cpu_stats"]["cpu_usage"]["total_usage"]) - float(
d["precpu_stats"]["cpu_usage"]["total_usage"]
Expand Down
4 changes: 3 additions & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;

# Set this so that the app updates function doesn't timeout

proxy_read_timeout 300s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
Expand Down

0 comments on commit 0849d98

Please sign in to comment.