mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Change request method from GET to POST
This commit is contained in:
parent
535b320969
commit
7565e65c64
1 changed files with 14 additions and 6 deletions
|
|
@ -702,19 +702,27 @@ func (c *Client) SnapshotTable(ctx context.Context, qtid dax.QualifiedTableID) e
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) WorkerCount(ctx context.Context, orgID string, databaseID string) (int, error) {
|
||||
func (c *Client) WorkerCount(ctx context.Context, qdbid dax.QualifiedDatabaseID) (int, error) {
|
||||
baseEndpoint := c.address.WithScheme(defaultScheme)
|
||||
url := fmt.Sprintf("%s/worker-count/%s/%s", baseEndpoint, orgID, databaseID)
|
||||
url := fmt.Sprintf("%s/worker-count", baseEndpoint)
|
||||
|
||||
resp, err := c.httpClient.Get(url)
|
||||
// Encode the request.
|
||||
postBody, err := json.Marshal(qdbid)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "getting worker-count")
|
||||
return 0, errors.Wrap(err, "marshalling post request")
|
||||
}
|
||||
responseBody := bytes.NewBuffer(postBody)
|
||||
|
||||
// Post the request.
|
||||
c.logger.Debugf("POST database-by-id request: url: %s", url)
|
||||
resp, err := c.httpClient.Post(url, "application/json", responseBody)
|
||||
if err != nil {
|
||||
return 0, errors.Wrap(err, "posting database-by-id request")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
return 0, errors.Errorf("status code: %d: %s", resp.StatusCode, b)
|
||||
return 0, errors.Wrapf(errors.UnmarshalJSON(resp.Body), "status code: %d", resp.StatusCode)
|
||||
}
|
||||
|
||||
var workers int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue