Skip to content

Commit 07a25e5

Browse files
committed
Log verbose error when 'increment_rsync_file_count()' fails
1 parent 641381a commit 07a25e5

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/murfey/server/api/__init__.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,22 @@ async def get_session(session_id: MurfeySessionID, db=murfey_db) -> SessionClien
367367
def increment_rsync_file_count(
368368
visit_name: str, rsyncer_info: RsyncerInfo, db=murfey_db
369369
):
370-
rsync_instance = db.exec(
371-
select(RsyncInstance).where(
372-
RsyncInstance.source == rsyncer_info.source,
373-
RsyncInstance.destination == rsyncer_info.destination,
374-
RsyncInstance.session_id == rsyncer_info.session_id,
370+
try:
371+
rsync_instance = db.exec(
372+
select(RsyncInstance).where(
373+
RsyncInstance.source == rsyncer_info.source,
374+
RsyncInstance.destination == rsyncer_info.destination,
375+
RsyncInstance.session_id == rsyncer_info.session_id,
376+
)
377+
).one()
378+
except Exception:
379+
log.error(
380+
f"Failed to find rsync instance for visit {sanitise(visit_name)} "
381+
"with the following properties: \n"
382+
f"{rsyncer_info.dict()}",
383+
exc_info=True,
375384
)
376-
).one()
385+
return None
377386
rsync_instance.files_counted += rsyncer_info.increment_count
378387
db.add(rsync_instance)
379388
db.commit()

0 commit comments

Comments
 (0)