Revert "Controller Liveliness Query Split (#5602)" (#5619)

This reverts commit 6c0b3a8a1c.
This commit is contained in:
dani authored and GitHub committed 2025-03-21 14:45:18 -04:00
1 parent 8b9d5cba5b
commit 143bc7055f
3 files changed
+2 -164

No files matched your search

-37
View File
@@ -76,40 +76,3 @@ func (r *Repository) UpsertController(ctx context.Context, controller *Controlle
return int(rowsUpdated), nil
}
func (r *Repository) UpdateController(ctx context.Context, controller *Controller) (int, error) {
const op = "server.(Repository).UpdateController"
if controller == nil {
return db.NoRowsAffected, errors.New(ctx, errors.InvalidParameter, op, "controller is nil")
}
if controller.PrivateId == "" {
return db.NoRowsAffected, errors.New(ctx, errors.InvalidParameter, op, "controller private_id is empty")
}
if controller.Address == "" {
return db.NoRowsAffected, errors.New(ctx, errors.InvalidParameter, op, "controller address is empty")
}
var rowsUpdated int
_, err := r.writer.DoTx(
ctx,
db.StdRetryCnt,
db.ExpBackoff{},
func(reader db.Reader, w db.Writer) error {
var err error
rowsUpdated, err = w.Update(ctx, controller, []string{"description", "address"}, nil, db.WithWhere("private_id = ?", controller.PrivateId))
if err != nil {
return errors.Wrap(ctx, err, op+":Update")
}
if rowsUpdated > 1 {
return errors.New(ctx, errors.MultipleRecords, op, "more than 1 resource would have been updated")
}
return nil
},
)
if err != nil {
return db.NoRowsAffected, err
}
return rowsUpdated, nil
}