Skip to content

Commit

Permalink
Add LockPull (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
leszko committed Mar 25, 2024
1 parent 3d67e2f commit ad476ea
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,21 @@ func (lapi *Client) Heartbeat(id string) error {
return err
}

// LockPull locks the stream pull
func (lapi *Client) LockPull(id string, leaseTimeoutMs time.Duration) error {
if id == "" {
return errors.New("empty id")
}

payload := map[string]interface{}{
"leaseTimeout": leaseTimeoutMs,
}
u := fmt.Sprintf("%s/api/stream/%s/lockPull", lapi.chosenServer, id)
err := lapi.doRequest("POST", u, "stream", "lock_pull", payload, nil)
glog.Infof("Ran lockPull request id=%s error=%q", id, err)
return err
}

// SetActive set isActive
func (lapi *Client) SetActive(id string, active bool, startedAt time.Time) (ok bool, err error) {
if id == "" {
Expand Down

0 comments on commit ad476ea

Please sign in to comment.