Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CondHandler ¶ added in v0.0.3
type CondHandler struct {
// contains filtered or unexported fields
}
This handler uses sync.Cond for flood handling. It has additional overhead of memory and locking. Flood is handled in separate for each api method.
func NewCondHandler ¶ added in v0.0.3
func NewCondHandler(onFlood OnFloodFunc) *CondHandler
type Handler ¶
type Handler interface {
Enter(
ctx context.Context,
method string,
request any,
) // Gets called BEFORE making an api request
Handle(
ctx context.Context,
method string,
request any,
duration time.Duration,
) // Gets called when 429 error happens
}
Interface for flood handlers. See `flood.CondHandler` or `flood.SleepHandler`. Or write one yourself.
type OnFloodFunc ¶ added in v0.0.3
type SleepHandler ¶
type SleepHandler struct {
OnFlood OnFloodFunc // Optional callback that will be called before sleeping
}
Dummy flood handler. It will just sleep for the flood duration.
See `flood.CondHandler`.
Click to show internal directories.
Click to hide internal directories.