quotas

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QuotaManager

type QuotaManager struct {
	// HourTimestamp: hourly timestamp used to handle hour limitations
	HourTimestamp time.Time
	// DayTimestamp: daily timestamp used to handle day limitations
	DayTimestamp time.Time
	// DmSent: quantity of dm sent in the last hour
	DmSent int
	// DmSentDay: quantity of dm sent in the last day
	DmSentDay int
	// MaxDmHour: maximum dm quantity per hour
	MaxDmHour int `yaml:"dm_per_hour" validate:"numeric"`
	// MaxDmDay: maximum dm quantity per day
	MaxDmDay int `yaml:"dm_per_day" validate:"numeric"`
	// Activated: quota manager activation boolean
	Activated bool `yaml:"activated"`
}

QuotaManager data

func (*QuotaManager) AddDm

func (qm *QuotaManager) AddDm()

AddDm report to the manager a message sending. It increment dm counter and check if quotas are still valid.

func (*QuotaManager) CheckQuotas

func (qm *QuotaManager) CheckQuotas()

CheckQuotas check if quotas have not been exceeded and pauses the program otherwise.

func (*QuotaManager) InitializeQuotaManager

func (qm *QuotaManager) InitializeQuotaManager()

InitializeQuotaManager initialize Quota manager with user settings

func (*QuotaManager) ResetDailyQuotas

func (qm *QuotaManager) ResetDailyQuotas()

ResetDailyQuotas reset daily dm counter and update timestamp

func (*QuotaManager) ResetHourlyQuotas

func (qm *QuotaManager) ResetHourlyQuotas()

ResetHourlyQuotas reset hourly dm counter and update timestamp

Jump to

Keyboard shortcuts

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