mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Return 0 instead of -1
This commit is contained in:
parent
59f1dc6dff
commit
cf418eb307
3 changed files with 5 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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{}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue