scheduler

package
v0.0.0-...-1c0d726 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JobTypePostPublish          = "post:publish"
	JobTypePostPublishTimelines = "post:publish:timelines"
	JobTypePostDelete           = "post:delete"
	JobTypePostDeleteRevisions  = "post:delete:revisions"
	JobTypePostDeleteReactions  = "post:delete:reactions"
	JobTypePostDeleteTimelines  = "post:delete:timelines"
	JobTypeProfileDelete        = "profile:delete"
	JobTypeAccountDelete        = "account:delete"
	JobTypeInstanceDelete       = "instance:delete"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDelete

type AccountDelete struct {
	AccountID uuid.UUID `json:"account_id"`
}

func (AccountDelete) Type

func (AccountDelete) Type() string

type Detail

type Detail interface {
	Type() string
}

type InstanceDelete

type InstanceDelete struct {
	InstanceID uuid.UUID `json:"instance_id"`
}

func (InstanceDelete) Type

func (InstanceDelete) Type() string

type PostDelete

type PostDelete struct {
	PostID uuid.UUID `json:"post_id"`

	SkipSoftDelete bool `json:"skip_soft_delete"`
}

func (PostDelete) Type

func (PostDelete) Type() string

type PostDeleteReactions

type PostDeleteReactions struct {
	PostID uuid.UUID `json:"post_id"`
}

func (PostDeleteReactions) Type

func (PostDeleteReactions) Type() string

type PostDeleteRevisions

type PostDeleteRevisions struct {
	PostID uuid.UUID `json:"post_id"`
}

func (PostDeleteRevisions) Type

func (PostDeleteRevisions) Type() string

type PostDeleteTimelines

type PostDeleteTimelines struct {
	PostID uuid.UUID `json:"post_id"`
}

func (PostDeleteTimelines) Type

func (PostDeleteTimelines) Type() string

type PostPublish

type PostPublish struct {
	ProfileID uuid.UUID   `json:"profile_id"`
	Subject   *string     `json:"subject"`
	Content   string      `json:"content"`
	Tags      []string    `json:"tags"`
	PollID    *uuid.UUID  `json:"poll_id"`
	GroupIDs  []uuid.UUID `json:"group_ids"`
	FileIDs   []uuid.UUID `json:"file_ids"`
	DeleteAt  *time.Time  `json:"delete_at"`
	// contains filtered or unexported fields
}

func (PostPublish) Type

func (PostPublish) Type() string

type PostPublishTimelines

type PostPublishTimelines struct {
	PostID uuid.UUID `json:"post_id"`
}

func (PostPublishTimelines) Type

type ProfileDelete

type ProfileDelete struct {
	ProfileID uuid.UUID `json:"profile_id"`
}

func (ProfileDelete) Type

func (ProfileDelete) Type() string

type Schedule

type Schedule struct {
	models.JobSchedule
	// contains filtered or unexported fields
}

func (*Schedule) Delete

func (schedule *Schedule) Delete() error

func (*Schedule) Start

func (schedule *Schedule) Start()

func (*Schedule) Stop

func (schedule *Schedule) Stop()

func (*Schedule) Update

func (schedule *Schedule) Update(s models.JobSchedule) error

type Scheduler

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

func NewScheduler

func NewScheduler(ctx context.Context, db *bun.DB, workers int) *Scheduler

func (*Scheduler) AutoCleanupOldJobs

func (scheduler *Scheduler) AutoCleanupOldJobs(every time.Duration)

func (*Scheduler) Listen

func (scheduler *Scheduler) Listen() error

func (*Scheduler) NewSchedule

func (scheduler *Scheduler) NewSchedule(s models.JobSchedule) (*Schedule, error)

func (*Scheduler) NewWorker

func (scheduler *Scheduler) NewWorker(id int, recheck bool) *Worker

func (*Scheduler) Queue

func (scheduler *Scheduler) Queue(detail Detail, scheduleID *uuid.UUID) (models.Job, error)

func (*Scheduler) Schedule

func (scheduler *Scheduler) Schedule(cron string, detail Detail) (models.JobSchedule, error)

func (*Scheduler) ScheduleOnce

func (scheduler *Scheduler) ScheduleOnce(at time.Time, detail Detail) (models.JobSchedule, error)

type Worker

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

func (Worker) Listen

func (w Worker) Listen(ctx context.Context, db *bun.DB) error

func (Worker) Recheck

func (w Worker) Recheck()

Jump to

Keyboard shortcuts

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