Return errors instead of exiting on rollback, rows close and blob temp file cleanup (closes #345)
check / check (push) Waiting to run
check / check (push) Waiting to run
WithReadTx ended the process when its rollback failed, including after Ctrl-C, when database/sql has already rolled back and Rollback returns sql.ErrTxDone; it now handles the rollback as WithTx does. The query functions ended the process when closing their rows failed; they now leave the deferred close alone, since database/sql reports a close failure through rows.Err(), which each returns. The unused database.Fatalf is removed. cleanupBlobTempFile now returns its close or remove failure, which fails the backup. No test makes a rows close fail: SQLite fails it only with the error the last read already returned. Model: opus-5-5
This commit was merged in pull request #364.
This commit is contained in:
@@ -107,12 +107,7 @@ func (r *ChunkRepository) GetByHashes(
|
||||
return nil, fmt.Errorf("querying chunks: %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := rows.Close()
|
||||
if err != nil {
|
||||
Fatalf("failed to close rows: %v", err)
|
||||
}
|
||||
}()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
var chunks []*Chunk
|
||||
|
||||
@@ -152,12 +147,7 @@ func (r *ChunkRepository) ListUnpacked(
|
||||
return nil, fmt.Errorf("querying unpacked chunks: %w", err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
err := rows.Close()
|
||||
if err != nil {
|
||||
Fatalf("failed to close rows: %v", err)
|
||||
}
|
||||
}()
|
||||
defer func() { _ = rows.Close() }()
|
||||
|
||||
var chunks []*Chunk
|
||||
|
||||
|
||||
Reference in New Issue
Block a user