diff --git a/local_storageV2.go b/local_storageV2.go index cf0897c..24856b8 100644 --- a/local_storageV2.go +++ b/local_storageV2.go @@ -251,6 +251,11 @@ func (s *SQLiteStorage) MarkAsExported(ctx context.Context, ids []int64) error { return nil } + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return err + } + placeholders := strings.Repeat("?,", len(ids)) placeholders = placeholders[:len(placeholders)-1] @@ -261,7 +266,17 @@ func (s *SQLiteStorage) MarkAsExported(ctx context.Context, ids []int64) error { args[i] = id } - _, err := s.db.ExecContext(ctx, sqlQuery, args...) + _, err = tx.ExecContext(ctx, sqlQuery, args...) + if err != nil { + tx.Rollback() + return err + } + + err = tx.Commit() + if err != nil { + return err + } + return err }