1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Removed last unnecessary cross-server HTTP call

This commit is contained in:
Krateng 2019-03-28 14:18:12 +01:00
parent d3e46ac50b
commit ef765352e0
2 changed files with 92 additions and 90 deletions

View File

@ -4,6 +4,7 @@
from bottle import Bottle, route, get, post, error, run, template, static_file, request, response, FormsDict, redirect, template
import waitress
# rest of the project
import database
from htmlgenerators import removeIdentical
from utilities import *
from htmlgenerators import KeySplit
@ -71,7 +72,8 @@ def database_post(pth):
def graceful_exit(sig=None,frame=None):
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
#urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
database.sync()
log("Server shutting down...")
os._exit(42)
@ -172,7 +174,8 @@ signal.signal(signal.SIGTERM, graceful_exit)
setproctitle.setproctitle("Maloja")
## start database server
_thread.start_new_thread(SourceFileLoader("database","database.py").load_module().runserver,(DATABASE_PORT,))
#_thread.start_new_thread(SourceFileLoader("database","database.py").load_module().runserver,(DATABASE_PORT,))
_thread.start_new_thread(database.runserver,(DATABASE_PORT,))
log("Starting up Maloja server...")
run(webserver, host='::', port=MAIN_PORT, server='waitress')

View File

@ -147,16 +147,16 @@ def addEntries(filename,al,escape=True):
### Useful functions
def int_or_none(input_):
try:
return int(input_)
except:
return None
#def int_or_none(input_):
# try:
# return int(input_)
# except:
# return None
def cleandict(d):
newdict = {k:d[k] for k in d if d[k] is not None}
d.clear()
d.update(newdict)
#def cleandict(d):
# newdict = {k:d[k] for k in d if d[k] is not None}
# d.clear()
# d.update(newdict)
@ -431,4 +431,3 @@ def resolveImage(artist=None,track=None):
return getTrackImage(track["artists"],track["title"])
elif artist is not None:
return getArtistImage(artist)