Resubmit a stored event as a new undelivered event (closes #250)
All checks were successful
check / check (push) Successful in 3m1s
All checks were successful
check / check (push) Successful in 3m1s
This commit was merged in pull request #251.
This commit is contained in:
@@ -44,6 +44,18 @@ const (
|
||||
// replayRateInterval is the time window for the replay limit.
|
||||
replayRateInterval = 1 * time.Minute
|
||||
|
||||
// resubmitRateLimit is the maximum number of event resubmits one
|
||||
// client may queue per interval. A resubmit stores an event and
|
||||
// queues one delivery per active target, so it costs more
|
||||
// outbound work per press than a replay does. Firing a captured
|
||||
// event repeatedly at a backend under development is the point of
|
||||
// the action, so the ceiling stays well above the rate a person
|
||||
// iterates at.
|
||||
resubmitRateLimit = 30
|
||||
|
||||
// resubmitRateInterval is the time window for the resubmit limit.
|
||||
resubmitRateInterval = 1 * time.Minute
|
||||
|
||||
// receiverRateInterval is the time window for the webhook
|
||||
// receiver rate limit. The configured limit is expressed in
|
||||
// requests per minute.
|
||||
@@ -315,6 +327,22 @@ func (m *Middleware) ReplayRateLimit() func(http.Handler) http.Handler {
|
||||
)
|
||||
}
|
||||
|
||||
// ResubmitRateLimit returns middleware that enforces per-IP rate
|
||||
// limiting on event resubmits.
|
||||
//
|
||||
// It is a separate bucket from the replay limit so that exhausting one
|
||||
// does not take the other away: replay is a recovery action and
|
||||
// resubmit is a testing action, and an operator iterating on a backend
|
||||
// must not lose the ability to re-send a failed delivery.
|
||||
func (m *Middleware) ResubmitRateLimit() func(http.Handler) http.Handler {
|
||||
return m.postRateLimit(
|
||||
resubmitRateLimit,
|
||||
resubmitRateInterval,
|
||||
"event resubmit rate limit exceeded",
|
||||
"Too many resubmits. Please try again later.",
|
||||
)
|
||||
}
|
||||
|
||||
// postRateLimit builds middleware that enforces a per-IP rate
|
||||
// limit on POST requests only; all other methods pass through
|
||||
// unaffected. Requests over the limit receive a 429 with the
|
||||
|
||||
Reference in New Issue
Block a user