fix(a2a,orgtoken,registry): handle RowsAffected errors in background paths #1906
@@ -434,7 +434,12 @@ func (h *WorkspaceHandler) stitchDrainResponseToDelegation(ctx context.Context,
|
||||
log.Printf("A2AQueue drain stitch: update failed for delegation %s: %v", delegationID, err)
|
||||
return
|
||||
}
|
||||
if rows, _ := res.RowsAffected(); rows == 0 {
|
||||
rows, err := res.RowsAffected()
|
||||
if err != nil {
|
||||
log.Printf("A2AQueue drain stitch: RowsAffected error for delegation %s: %v", delegationID, err)
|
||||
return
|
||||
}
|
||||
if rows == 0 {
|
||||
log.Printf("A2AQueue drain stitch: no delegate_result row for delegation %s (queued-row may not exist yet)", delegationID)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -192,7 +192,10 @@ func Revoke(ctx context.Context, db *sql.DB, id string) (bool, error) {
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("orgtoken: revoke: %w", err)
|
||||
}
|
||||
n, _ := res.RowsAffected()
|
||||
n, err := res.RowsAffected()
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("orgtoken: revoke RowsAffected: %w", err)
|
||||
}
|
||||
return n > 0, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,11 @@ func sweepStuckProvisioning(ctx context.Context, emitter ProvisionTimeoutEmitter
|
||||
log.Printf("Provision-timeout sweep: failed to flip %s to failed: %v", c.id, err)
|
||||
continue
|
||||
}
|
||||
affected, _ := res.RowsAffected()
|
||||
affected, err := res.RowsAffected()
|
||||
if err != nil {
|
||||
log.Printf("Provision-timeout sweep: RowsAffected error for %s: %v", c.id, err)
|
||||
continue
|
||||
}
|
||||
if affected == 0 {
|
||||
// Raced with restart / register — no harm, just skip.
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user