All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m20s
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package constants
|
|
|
|
import "time"
|
|
|
|
const (
|
|
// OutboxStatusPending 表示事件待投递。
|
|
OutboxStatusPending = 1
|
|
// OutboxStatusDelivering 表示事件已被 Relay 租约领取。
|
|
OutboxStatusDelivering = 2
|
|
// OutboxStatusDelivered 表示事件已成功提交到队列。
|
|
OutboxStatusDelivered = 3
|
|
// OutboxStatusFailed 表示事件达到最终失败或等待人工重放。
|
|
OutboxStatusFailed = 4
|
|
)
|
|
|
|
const (
|
|
// OutboxDefaultMaxRetries 是公共 Outbox 默认最大重试次数。
|
|
OutboxDefaultMaxRetries = 10
|
|
// OutboxDefaultLeaseDuration 是 Relay 默认租约时长。
|
|
OutboxDefaultLeaseDuration = time.Minute
|
|
// OutboxDefaultBatchSize 是 Relay 默认单批领取数。
|
|
OutboxDefaultBatchSize = 100
|
|
// OutboxBaseRetryDelay 是瞬时失败指数退避的基础时长。
|
|
OutboxBaseRetryDelay = 5 * time.Second
|
|
// OutboxMaxRetryDelay 是瞬时失败指数退避的上限。
|
|
OutboxMaxRetryDelay = 30 * time.Minute
|
|
// OutboxRelayPollInterval 是 Worker 扫描到期事件的默认间隔。
|
|
OutboxRelayPollInterval = time.Second
|
|
)
|
|
|
|
// GetOutboxStatusName 返回 Outbox 内部状态中文名称。
|
|
func GetOutboxStatusName(status int) string {
|
|
switch status {
|
|
case OutboxStatusPending:
|
|
return "待投递"
|
|
case OutboxStatusDelivering:
|
|
return "投递中"
|
|
case OutboxStatusDelivered:
|
|
return "已投递"
|
|
case OutboxStatusFailed:
|
|
return "投递失败"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|