Documentation
¶
Index ¶
Constants ¶
View Source
const RemoveConsumerDuration = 5 * time.Minute
View Source
const TaskFunction_ArchiveTasks = "task-archive"
View Source
const TaskFunction_HelmSyncCharts = "helm-sync-charts"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApplicationTasker ¶
type ApplicationTasker struct {
*application.ApplicationProcessor
}
func (*ApplicationTasker) ProvideFuntions ¶
func (t *ApplicationTasker) ProvideFuntions() map[string]interface{}
type CronTasker ¶
某些任务处理本身会有定时任务,可以实现该接口
type HelmSyncTasker ¶
func (*HelmSyncTasker) Crontasks ¶
func (s *HelmSyncTasker) Crontasks() map[string]Task
func (*HelmSyncTasker) ProvideFuntions ¶
func (t *HelmSyncTasker) ProvideFuntions() map[string]interface{}
func (*HelmSyncTasker) SyncCharts ¶
func (t *HelmSyncTasker) SyncCharts(ctx context.Context) error
type ProcessorContext ¶
func (*ProcessorContext) RegisterTasker ¶
func (p *ProcessorContext) RegisterTasker(taskers ...Tasker) error
func (*ProcessorContext) RunCronTasksWithLock ¶
func (p *ProcessorContext) RunCronTasksWithLock(ctx context.Context) error
由于worker是多副本的,且crontask 只能在 worker上运行cron。 为了避免多个worker都执行,使用redis 锁选择一个worker来触发这些crontask
type SampleTasker ¶
type SampleTasker struct{}
func (*SampleTasker) Crontasks ¶
func (s *SampleTasker) Crontasks() map[string]Task
func (*SampleTasker) ProvideFuntions ¶
func (s *SampleTasker) ProvideFuntions() map[string]interface{}
type TaskArchiverTasker ¶
type TaskArchiverTasker struct { Databse *database.Database Redis *redis.Client // contains filtered or unexported fields }
用于转移超过时间的任务记录至database
func NewTaskArchiverTasker ¶
func NewTaskArchiverTasker(databse *database.Database, redis *redis.Client) *TaskArchiverTasker
func (*TaskArchiverTasker) ArchiveOutdated ¶
func (t *TaskArchiverTasker) ArchiveOutdated(ctx context.Context) error
func (*TaskArchiverTasker) Crontasks ¶
func (t *TaskArchiverTasker) Crontasks() map[string]Task
func (*TaskArchiverTasker) ProvideFuntions ¶
func (t *TaskArchiverTasker) ProvideFuntions() map[string]interface{}
func (*TaskArchiverTasker) RemoveOffline ¶
func (t *TaskArchiverTasker) RemoveOffline(ctx context.Context) error
RemoveOffline 删除长时间不活跃的worker正在处理的任务
Click to show internal directories.
Click to hide internal directories.