mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## What changed? Introduces shared constants for default long poll timeout/buffer and applies them to SAA and SANO. ## Why? After a long internal technical discussion, 60s was determined as the default for the timeout.
64 lines
2.3 KiB
Go
64 lines
2.3 KiB
Go
package common
|
|
|
|
import (
|
|
"math"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
// FirstEventID is the id of the first event in the history
|
|
FirstEventID int64 = 1
|
|
// LastEventID is the id of the last possible event in the history
|
|
LastEventID int64 = math.MaxInt64
|
|
// EmptyEventID is the id of the empty event
|
|
EmptyEventID int64 = 0
|
|
// EmptyVersion is used as the default value for failover version when no value is provided
|
|
EmptyVersion int64 = 0
|
|
// EndEventID is the id of the end event, here we use the int64 max
|
|
EndEventID int64 = 1<<63 - 1
|
|
// BufferedEventID is the id of the buffered event
|
|
BufferedEventID int64 = -123
|
|
// EmptyEventTaskID is uninitialized id of the task id within event
|
|
EmptyEventTaskID int64 = 0
|
|
// TransientEventID is the id of the transient event
|
|
TransientEventID int64 = -124
|
|
// FirstBlobPageToken is the page token identifying the first blob for each history archival
|
|
FirstBlobPageToken = 1
|
|
// LastBlobNextPageToken is the next page token on the last blob for each history archival
|
|
LastBlobNextPageToken = -1
|
|
// EndMessageID is the id of the end message, here we use the int64 max
|
|
EndMessageID int64 = 1<<63 - 1
|
|
)
|
|
|
|
const (
|
|
// DefaultLongPollTimeout is the default context timeout for a long poll request.
|
|
DefaultLongPollTimeout = time.Second * 60
|
|
// DefaultLongPollBuffer is the buffer used to adjust a long poll request timeout.
|
|
// Specifically, long poll requests are timed out at a time which leaves at least the buffer's duration
|
|
// remaining before the caller's deadline, if permitted by the caller's deadline.
|
|
DefaultLongPollBuffer = time.Second
|
|
// MinLongPollTimeout is the minimum context timeout for a long poll request, below which
|
|
// the request won't be processed.
|
|
MinLongPollTimeout = time.Second * 2
|
|
// CriticalLongPollTimeout is a threshold for the context timeout passed into a long poll request,
|
|
// below which a warning will be logged
|
|
CriticalLongPollTimeout = time.Second * 10
|
|
)
|
|
|
|
const (
|
|
// Limit for schedule notes field
|
|
ScheduleNotesSizeLimit = 1000
|
|
|
|
ScheduledTaskMinPrecision = time.Millisecond
|
|
)
|
|
|
|
const (
|
|
// DefaultQueueReaderID is the default readerID when loading history tasks
|
|
DefaultQueueReaderID int64 = 0
|
|
)
|
|
|
|
const (
|
|
// DefaultOperatorRPSRatio is the default percentage of rate limit that should be used for operator priority requests
|
|
DefaultOperatorRPSRatio float64 = 0.2
|
|
)
|