diff --git a/dax/controller/client/client.go b/dax/controller/client/client.go index 1b95ee8ce..3636a60db 100644 --- a/dax/controller/client/client.go +++ b/dax/controller/client/client.go @@ -708,18 +708,18 @@ func (c *Client) GetDatabaseWorkerCount(ctx context.Context, orgID string, datab resp, err := c.httpClient.Get(url) if err != nil { - return -1, errors.Wrap(err, "getting database-worker-count") + return 0, errors.Wrap(err, "getting database-worker-count") } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { b, _ := io.ReadAll(resp.Body) - return -1, errors.Errorf("status code: %d: %s", resp.StatusCode, b) + return 0, errors.Errorf("status code: %d: %s", resp.StatusCode, b) } var workers int if err := json.NewDecoder(resp.Body).Decode(&workers); err != nil { - return -1, errors.Wrap(err, "reading response body") + return 0, errors.Wrap(err, "reading response body") } return workers, nil diff --git a/dax/controller/controller.go b/dax/controller/controller.go index fc760133e..6efd9147a 100644 --- a/dax/controller/controller.go +++ b/dax/controller/controller.go @@ -789,7 +789,7 @@ func (c *Controller) WorkerCount(ctx context.Context, qdbid dax.QualifiedDatabas tx, err := c.Transactor.BeginTx(ctx, false) if err != nil { - return -1, errors.Wrap(err, "beginning tx") + return 0, errors.Wrap(err, "beginning tx") } defer tx.Rollback() diff --git a/dax/controller/sqldb/workerjob.go b/dax/controller/sqldb/workerjob.go index 7acb6dab8..c2994724e 100644 --- a/dax/controller/sqldb/workerjob.go +++ b/dax/controller/sqldb/workerjob.go @@ -72,7 +72,7 @@ func jobsForWorker(dt *DaxTransaction, worker *models.Worker, roleType dax.RoleT func (w *workerJobService) WorkerCount(tx dax.Transaction, roleType dax.RoleType, qdbid dax.QualifiedDatabaseID) (int, error) { dt, ok := tx.(*DaxTransaction) if !ok { - return -1, dax.NewErrInvalidTransaction("*sqldb.DaxTransaction") + return 0, dax.NewErrInvalidTransaction("*sqldb.DaxTransaction") } worker := &models.Worker{}