55 lines
1.8 KiB
Go
55 lines
1.8 KiB
Go
// Package constants defines task-related constants for the async task system
|
|
package constants
|
|
|
|
import "time"
|
|
|
|
// Task priority levels
|
|
const (
|
|
// TaskPriorityDefault is the default priority level for tasks
|
|
TaskPriorityDefault = 5
|
|
// TaskPriorityHigh represents high priority tasks
|
|
TaskPriorityHigh = 10
|
|
// TaskPriorityLow represents low priority tasks
|
|
TaskPriorityLow = 1
|
|
)
|
|
|
|
// Task queue configuration
|
|
const (
|
|
// TaskExchangeName is the name of the exchange for task routing
|
|
TaskExchangeName = "modelrt.tasks.exchange"
|
|
// TaskQueueName is the name of the main task queue
|
|
TaskQueueName = "modelrt.tasks.queue"
|
|
// TaskRoutingKey is the routing key for task messages
|
|
TaskRoutingKey = "modelrt.task"
|
|
)
|
|
|
|
// Task message settings
|
|
const (
|
|
// TaskMaxPriority is the maximum priority level for tasks (0-10)
|
|
TaskMaxPriority = 10
|
|
// TaskDefaultMessageTTL is the default time-to-live for task messages (24 hours)
|
|
TaskDefaultMessageTTL = 24 * time.Hour
|
|
)
|
|
|
|
// Task retry settings
|
|
const (
|
|
// TaskRetryMaxDefault is the default maximum number of retry attempts
|
|
TaskRetryMaxDefault = 3
|
|
// TaskRetryInitialDelayDefault is the default initial delay for exponential backoff
|
|
TaskRetryInitialDelayDefault = 1 * time.Second
|
|
// TaskRetryMaxDelayDefault is the default maximum delay for exponential backoff
|
|
TaskRetryMaxDelayDefault = 5 * time.Minute
|
|
// TaskRetryRandomFactorDefault is the default random factor for jitter (10%)
|
|
TaskRetryRandomFactorDefault = 0.1
|
|
// TaskRetryFixedDelayDefault is the default delay for fixed retry strategy
|
|
TaskRetryFixedDelayDefault = 5 * time.Second
|
|
)
|
|
|
|
// Test task settings
|
|
const (
|
|
// TestTaskSleepDurationDefault is the default sleep duration for test tasks (60 seconds)
|
|
TestTaskSleepDurationDefault = 60
|
|
// TestTaskSleepDurationMax is the maximum allowed sleep duration for test tasks (1 hour)
|
|
TestTaskSleepDurationMax = 3600
|
|
)
|