Don't fail to process background jobs because one failed

This commit is contained in:
Eli Ribble 2026-04-17 20:51:24 +00:00
parent ac552be7e7
commit abbe80b1f0
No known key found for this signature in database

View file

@ -90,18 +90,18 @@ func addWaitingJobs(ctx context.Context) error {
txn, err := db.PGInstance.BobDB.Begin(ctx) txn, err := db.PGInstance.BobDB.Begin(ctx)
if err != nil { if err != nil {
sublog.Error().Err(err).Msg("failed begin txn") sublog.Error().Err(err).Msg("failed begin txn")
return continue
} }
defer txn.Rollback(ctx) defer txn.Rollback(ctx)
err = handleJob(ctx, txn, job) err = handleJob(ctx, txn, job)
if err != nil { if err != nil {
sublog.Error().Err(err).Msg("failed handle job") sublog.Error().Err(err).Msg("failed handle job")
return continue
} }
err = job.Delete(ctx, txn) err = job.Delete(ctx, txn)
if err != nil { if err != nil {
sublog.Error().Err(err).Msg("failed delete job") sublog.Error().Err(err).Msg("failed delete job")
return continue
} }
sublog.Info().Msg("job complete") sublog.Info().Msg("job complete")
txn.Commit(ctx) txn.Commit(ctx)