From e3f9c5f8015971a70fa077e9c8a83a9d64feb2e7 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Fri, 25 Nov 2022 15:15:05 +1100
Subject: [PATCH] fix up logging, increase idel websockets out to 5 minutes

---
 nginx_snippets/tws.conf | 3 +++
 twsproxy/__init__.py    | 4 +---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/nginx_snippets/tws.conf b/nginx_snippets/tws.conf
index 89c5bd8..82aa548 100644
--- a/nginx_snippets/tws.conf
+++ b/nginx_snippets/tws.conf
@@ -5,6 +5,9 @@ location / {
 	proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
+        proxy_read_timeout 300;
+        proxy_connect_timeout 300;
+        proxy_send_timeout 300;
         add_header 'Access-Control-Allow-Origin' $http_origin;
         add_header 'Access-Control-Allow-Credentials' 'true';
 	client_max_body_size 50M;
diff --git a/twsproxy/__init__.py b/twsproxy/__init__.py
index 1de828e..e805484 100644
--- a/twsproxy/__init__.py
+++ b/twsproxy/__init__.py
@@ -171,8 +171,6 @@ class TWSProxy(threading.Thread):
                 if msglength > 0:
                     TWSProxy.reliablesend(dest,buff,msglength)
                 if msglength == 0:
-                    logger.debug('socket shutdown, fh ready to read but 0 bytes returned')
-                    logger.debug('{} {}'.format(r,src))
                     #dest.send(buff)
                     dest.shutdown(shuttype)
                     initshutdown.set()
@@ -192,7 +190,7 @@ def mainserver(port=None):
         logger = logging.getLogger()
         handler = TimedRotatingFileHandler(filename="/var/log/strudel2/tws.log",when='h',interval=24,backupCount=7)
         formatter = logging.Formatter("%(asctime)s %(levelname)s:%(process)s: %(message)s")
-        handler.setFormattter(formatter)
+        handler.setFormatter(formatter)
         logger.addHandler(handler)
     except Exception as e:
         import traceback
-- 
GitLab