Skip to content

Commit

Permalink
archiveloop: don't clean on bootup
Browse files Browse the repository at this point in the history
Only clean the cam image after successful archiving, to prevent
sentry events being deleted that haven't yet been archived, and
may be lost when snapshots are expired.
  • Loading branch information
marcone committed Feb 2, 2025
1 parent df02817 commit 7f91860
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions run/archiveloop
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ function archive_teslacam_clips () {
log "There are $event_count event folder(s) with $sentry_count file(s) and $trackmode_count track mode file(s) to move." \
" $ignore_count short recording(s) will be skipped."

local archive_success=true
if [[ "$total_count" -gt 0 ]]
then
log "Starting recording archiving"
Expand Down Expand Up @@ -575,6 +576,7 @@ function archive_teslacam_clips () {
message="Archiving completed successfully. "
else
message="Error during archiving. "
archive_success=false
fi

local -i sentry_archived=0
Expand Down Expand Up @@ -630,7 +632,12 @@ function archive_teslacam_clips () {

if archive_is_reachable
then
clean_cam_mount
if [ "$archive_success" = "true" ]
then
clean_cam_mount
else
log "Skipping cleaning step after archive error"
fi
else
log "Archive not reachable, assuming user drove away, skipping cleaning step"
fi
Expand Down Expand Up @@ -850,8 +857,6 @@ if has_cam_disk
then
# don't need another fsck because fix_errors_in_images already did that
/root/bin/make_snapshot.sh nofsck

clean_cam_mount
fi

connect_usb_drives_to_host
Expand Down

0 comments on commit 7f91860

Please sign in to comment.