if __name__ == '__main__':
t = threading.Thread(target = authtarget)
t.daemon = True
t.start()
print 'running thread'
app.run(debug=True)
This main is in our server, where app.run will start the server and will be able to handle requests. The thread we are making is a timer that checks a certain if statement every 5 seconds. However, t.start() will create two threads instead of only one. We've tried changing t.start() to t.run() however when we do that we never get to app.run, which we need to run the server.
def authtarget():
sp = Spotify()
db = Database()
resultList = []
while True:
time.sleep(5)
sp.timer(204)
timer() is a function that we need called every 5 seconds. However, with the code that we have currently, timer gets called twice instead of once every 5 seconds
Thanks guys, I just changed app.run(debug=True) to app.run(debug=False) so that it didn't run twice
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With