Compare commits

..

2 Commits

Author SHA1 Message Date
Keith Edmunds
c0c90595fd Close Session context before importing tracks 2022-09-09 07:29:46 +01:00
Keith Edmunds
7163a4c6e4 Re-enable session logging 2022-09-09 07:29:20 +01:00
2 changed files with 9 additions and 7 deletions

View File

@ -45,9 +45,11 @@ def Session() -> Generator[scoped_session, None, None]:
function = frame.function function = frame.function
lineno = frame.lineno lineno = frame.lineno
Session = scoped_session(sessionmaker(bind=engine, future=True)) Session = scoped_session(sessionmaker(bind=engine, future=True))
# log.debug(f"Session acquired, {file=}, {function=}, log.debug(
# function{lineno=}, {Session=}") f"Session acquired, {file=}, {function=}, "
f"function{lineno=}, {Session=}"
)
yield Session yield Session
# log.debug(" Session released") log.debug(" Session released")
Session.commit() Session.commit()
Session.close() Session.close()

View File

@ -480,10 +480,10 @@ class Window(QMainWindow, Ui_MainWindow):
if result == QMessageBox.Cancel: if result == QMessageBox.Cancel:
return return
# Import in separate thread # Import in separate thread
thread = threading.Thread(target=self._import_tracks, thread = threading.Thread(target=self._import_tracks,
args=(new_tracks,)) args=(new_tracks,))
thread.start() thread.start()
def _import_tracks(self, tracks: list): def _import_tracks(self, tracks: list):
""" """