From 09ea798e38083317d4caaf4f5767203748c1bc54 Mon Sep 17 00:00:00 2001 From: Igor Nurullaev Date: Wed, 28 Aug 2019 18:22:05 +0300 Subject: [PATCH] Deleted unneeded file --- Server/flask_test.py | 55 -------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 Server/flask_test.py diff --git a/Server/flask_test.py b/Server/flask_test.py deleted file mode 100644 index 708fef9..0000000 --- a/Server/flask_test.py +++ /dev/null @@ -1,55 +0,0 @@ -import threading -import atexit -from flask import Flask -from server import * - -POOL_TIME = 0 # Seconds - - -class ServerThread(threading.Thread): - def run(self): - server = Server() - server.start() - while True: - pass - - -# variables that are accessible from anywhere -commonDataStruct = {} -# lock to control access to variable -dataLock = threading.Lock() -# thread handler -yourThread = ServerThread() - - -def create_app(): - app = Flask(__name__) - - def interrupt(): - global yourThread - yourThread.cancel() - - def doStuff(): - global commonDataStruct - global yourThread - with dataLock: - print('kek') - yourThread = threading.Timer(POOL_TIME, doStuff, ()) - yourThread.start() - - def doStuffStart(): - # Do initialisation stuff here - global yourThread - # Create your thread - yourThread = threading.Timer(POOL_TIME, doStuff, ()) - yourThread.start() - - # Initiate - doStuffStart() - # When you kill Flask (SIGTERM), clear the trigger for the next thread - atexit.register(interrupt) - return app - - -app = create_app() -app.run(host='0.0.0.0', debug=True)