Use one more argument for leaseSeconds
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a38d2147bf
commit
198d18fe17
|
@ -150,7 +150,12 @@ func (h *hubIncomingBackend) UpdateFeed(subscriptionID int64, contentType string
|
|||
|
||||
func (h *hubIncomingBackend) FeedSetLeaseSeconds(subscriptionID int64, leaseSeconds int64) error {
|
||||
db := h.backend.database
|
||||
_, err := db.Exec("update subscriptions set lease_seconds = $1, resubscribe_at = now() + $1 * interval '1' second where id = $2", leaseSeconds, subscriptionID)
|
||||
_, err := db.Exec(`
|
||||
update subscriptions
|
||||
set lease_seconds = $1,
|
||||
resubscribe_at = now() + $2 * interval '1' second
|
||||
where id = $3
|
||||
`, leaseSeconds, leaseSeconds, subscriptionID)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -49,11 +49,13 @@ func (h *incomingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
leaseSeconds, err := strconv.ParseInt(leaseStr, 10, 64)
|
||||
if err != nil {
|
||||
log.Printf("error in hub.lease_seconds format %q: %s", leaseSeconds, err)
|
||||
http.Error(w, fmt.Sprintf("error in hub.lease_seconds format %q: %s", leaseSeconds, err), 400)
|
||||
return
|
||||
}
|
||||
err = h.Backend.FeedSetLeaseSeconds(feed, leaseSeconds)
|
||||
if err != nil {
|
||||
log.Printf("error in while setting hub.lease_seconds: %s", err)
|
||||
http.Error(w, fmt.Sprintf("error in while setting hub.lease_seconds: %s", err), 400)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user