mirror of
https://github.com/krateng/maloja.git
synced 2025-07-09 03:04:07 -04:00
Spaghetti Code
This commit is contained in:
parent
12b5eb0b74
commit
fd5d01b728
@ -45,6 +45,16 @@ dbstatus = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# we're running an auxiliary task that doesn't require all the random background
|
||||||
|
# nonsense to be fired up
|
||||||
|
# this is temporary
|
||||||
|
# FIX YO DAMN ARCHITECTURE ALREADY
|
||||||
|
AUX_MODE = False
|
||||||
|
def set_aux_mode():
|
||||||
|
global AUX_MODE
|
||||||
|
AUX_MODE = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def waitfordb(func):
|
def waitfordb(func):
|
||||||
def newfunc(*args,**kwargs):
|
def newfunc(*args,**kwargs):
|
||||||
|
@ -22,6 +22,8 @@ if malojaconfig['USE_GLOBAL_CACHE']:
|
|||||||
|
|
||||||
@runhourly
|
@runhourly
|
||||||
def maintenance():
|
def maintenance():
|
||||||
|
from . import AUX_MODE
|
||||||
|
if not AUX_MODE:
|
||||||
print_stats()
|
print_stats()
|
||||||
trim_cache()
|
trim_cache()
|
||||||
|
|
||||||
|
@ -1327,6 +1327,10 @@ def search_album(searchterm,dbconn=None):
|
|||||||
@connection_provider
|
@connection_provider
|
||||||
def clean_db(dbconn=None):
|
def clean_db(dbconn=None):
|
||||||
|
|
||||||
|
from . import AUX_MODE
|
||||||
|
|
||||||
|
if not AUX_MODE:
|
||||||
|
with SCROBBLE_LOCK:
|
||||||
log(f"Database Cleanup...")
|
log(f"Database Cleanup...")
|
||||||
|
|
||||||
to_delete = [
|
to_delete = [
|
||||||
@ -1352,6 +1356,7 @@ def clean_db(dbconn=None):
|
|||||||
]
|
]
|
||||||
|
|
||||||
for d in to_delete:
|
for d in to_delete:
|
||||||
|
print(d)
|
||||||
selection = dbconn.execute(sql.text(f"select * {d}"))
|
selection = dbconn.execute(sql.text(f"select * {d}"))
|
||||||
for row in selection.all():
|
for row in selection.all():
|
||||||
log(f"Deleting {row}")
|
log(f"Deleting {row}")
|
||||||
|
@ -21,6 +21,9 @@ outputs = {
|
|||||||
|
|
||||||
def import_scrobbles(inputf):
|
def import_scrobbles(inputf):
|
||||||
|
|
||||||
|
from ...database import set_aux_mode
|
||||||
|
set_aux_mode()
|
||||||
|
|
||||||
from ...database.sqldb import add_scrobbles
|
from ...database.sqldb import add_scrobbles
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user