tasks

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package tasks provides background task implementations for the runner.

Package tasks provides background task implementations for the runner.

Index

Constants

View Source
const (
	// MaxRetries is the maximum number of retry attempts for failed emails.
	MaxRetries = 5
	// RetryDelayBase is the base delay for exponential backoff (in minutes).
	RetryDelayBase = 5
)

Variables

This section is empty.

Functions

func NewEmailQueueTask

func NewEmailQueueTask(db *sql.DB, cfg *config.EmailConfig) runner.Task

NewEmailQueueTask creates a new email queue task.

func NewNotificationEventsTask added in v0.10.0

func NewNotificationEventsTask(db *sql.DB) runner.Task

NewNotificationEventsTask creates the notification event task.

func NewSearchIndexTask added in v0.10.0

func NewSearchIndexTask(db *sql.DB, backend *search.ExternalBackend) runner.Task

NewSearchIndexTask creates the search index task for backend.

func NewSessionCleanupTask

func NewSessionCleanupTask(db *sql.DB) runner.Task

NewSessionCleanupTask creates a new session cleanup task.

func NewWebhookDispatchTask added in v0.10.0

func NewWebhookDispatchTask(db *sql.DB) runner.Task

NewWebhookDispatchTask creates the webhook dispatch task.

Types

type EmailQueueTask

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

EmailQueueTask processes emails from the mail queue.

func (*EmailQueueTask) Name

func (t *EmailQueueTask) Name() string

Name returns the task name.

func (*EmailQueueTask) Run

func (t *EmailQueueTask) Run(ctx context.Context) error

Run processes pending emails from the queue.

func (*EmailQueueTask) Schedule

func (t *EmailQueueTask) Schedule() string

Schedule returns the cron schedule (every 30 seconds).

func (*EmailQueueTask) Timeout

func (t *EmailQueueTask) Timeout() time.Duration

Timeout returns the task timeout (5 minutes).

type NotificationEventsTask added in v0.10.0

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

NotificationEventsTask evaluates the ticket notification rules (Admin -> Ticket Notifications) for new ticket events and queues the emails on mail_queue, which the email queue task sends.

func (*NotificationEventsTask) Name added in v0.10.0

func (t *NotificationEventsTask) Name() string

Name returns the task name.

func (*NotificationEventsTask) Run added in v0.10.0

Run evaluates the events written since the previous run. A run that starts while the previous one is still evaluating returns immediately.

func (*NotificationEventsTask) Schedule added in v0.10.0

func (t *NotificationEventsTask) Schedule() string

Schedule runs the task every 10 seconds.

func (*NotificationEventsTask) Timeout added in v0.10.0

func (t *NotificationEventsTask) Timeout() time.Duration

Timeout bounds one run; events left over continue next run.

type SearchIndexTask added in v0.10.0

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

SearchIndexTask keeps the Zinc/Elasticsearch index in step with the database: it builds the index when needed and reindexes changed tickets, articles and customer users.

func (*SearchIndexTask) Name added in v0.10.0

func (t *SearchIndexTask) Name() string

Name returns the task name.

func (*SearchIndexTask) Run added in v0.10.0

func (t *SearchIndexTask) Run(ctx context.Context) error

Run syncs the index. A run that starts while the previous one is still going returns immediately.

func (*SearchIndexTask) Schedule added in v0.10.0

func (t *SearchIndexTask) Schedule() string

Schedule runs the task every 30 seconds.

func (*SearchIndexTask) Timeout added in v0.10.0

func (t *SearchIndexTask) Timeout() time.Duration

Timeout bounds one run; a first build of a large database can take long.

type SessionCleanupTask

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

SessionCleanupTask cleans up expired sessions from the database.

func (*SessionCleanupTask) Name

func (t *SessionCleanupTask) Name() string

Name returns the task name.

func (*SessionCleanupTask) Run

Run cleans up expired sessions.

func (*SessionCleanupTask) Schedule

func (t *SessionCleanupTask) Schedule() string

Schedule returns the cron schedule based on configured interval.

func (*SessionCleanupTask) Timeout

func (t *SessionCleanupTask) Timeout() time.Duration

Timeout returns the task timeout (2 minutes).

type WebhookDispatchTask added in v0.10.0

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

WebhookDispatchTask publishes ticket/article events to outbound webhooks and sends due deliveries (first attempts and retries).

func (*WebhookDispatchTask) Name added in v0.10.0

func (t *WebhookDispatchTask) Name() string

Name returns the task name.

func (*WebhookDispatchTask) Run added in v0.10.0

Run publishes new events and sends due deliveries. A run that starts while the previous one is still sending returns immediately.

func (*WebhookDispatchTask) Schedule added in v0.10.0

func (t *WebhookDispatchTask) Schedule() string

Schedule runs the task every 10 seconds.

func (*WebhookDispatchTask) Timeout added in v0.10.0

func (t *WebhookDispatchTask) Timeout() time.Duration

Timeout bounds one run; sends still pending afterwards continue next run.

Jump to

Keyboard shortcuts

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