invokers

package
v0.38.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package invokers contains some middlewares and helpers to work with RPC invokers.

Index

Constants

View Source
const ErrFloodWait = "FLOOD_WAIT"

ErrFloodWait is error type of "FLOOD_WAIT" error.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object interface {
	TypeID() uint32
}

Object is a abstraction for Telegram API object with TypeID.

type Waiter

type Waiter struct {
	// contains filtered or unexported fields
}

Waiter is a invoker middleware to handle FLOOD_WAIT errors from Telegram.

func NewWaiter

func NewWaiter(prev tg.Invoker) *Waiter

NewWaiter creates new Waiter invoker middleware.

func (*Waiter) InvokeRaw

func (w *Waiter) InvokeRaw(ctx context.Context, input bin.Encoder, output bin.Decoder) error

InvokeRaw implements tg.Invoker.

func (*Waiter) Run

func (w *Waiter) Run(ctx context.Context) error

Run runs send loop.

func (*Waiter) WithClock

func (w *Waiter) WithClock(c clock.Clock) *Waiter

WithClock sets clock to use.

func (*Waiter) WithRetryLimit

func (w *Waiter) WithRetryLimit(retryLimit int) *Waiter

WithRetryLimit sets retry limit to use.

func (*Waiter) WithTick

func (w *Waiter) WithTick(tick time.Duration) *Waiter

WithTick sets gather tick for Waiter.

func (*Waiter) WithWaitLimit

func (w *Waiter) WithWaitLimit(waitLimit int) *Waiter

WithWaitLimit sets wait limit to use.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL