scheduler

package
v0.0.0-...-c47d08d Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApiRequestQuota per second
	ApiRequestQuota        = 30
	ApiRequestQuotaTimeout = time.Second

	// ApiRequestQuotaPerChat per minute
	ApiRequestQuotaPerChat        = 20
	ApiRequestQuotaPerChatTimeout = time.Minute

	DefaultPollingRate = time.Millisecond * 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RawFunc

type RawFunc func() ([]byte, error)

type Scheduler

type Scheduler interface {
	SyncFunc(count int, chat string, fn RawFunc) ([]byte, error)
}

func Conservative

func Conservative() Scheduler

Conservative gives you a headroom of 20% compared to Default, just in case something goes wrong.

func Custom

func Custom(global int, perChat int, pollingRate time.Duration) Scheduler

Custom Telegram API limits, global -- per second, perChat -- per minute.

func Default

func Default() Scheduler

Default Telegram API limits, 20/minute -- per group chat quota, 30/second -- global quota.

func ExtraConservative

func ExtraConservative() Scheduler

ExtraConservative gives you a headroom of 50% compared to Default, just in case something goes wrong. Required, if you are planning on uploading tons of files in a chat continuously.

func Nil

func Nil() Scheduler

Nil scheduler does nothing, performing all functions ASAP.

Jump to

Keyboard shortcuts

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