remove references to the queue

This commit is contained in:
Jay
2026-05-20 08:53:46 -04:00
parent 093a56ea56
commit 6facb6eed0
2 changed files with 0 additions and 34 deletions
-26
View File
@@ -157,7 +157,6 @@ func WithWorkerFactory(wf WorkerFactory) PoolOption {
type WorkerConfig struct { type WorkerConfig struct {
KeepaliveTimeout time.Duration KeepaliveTimeout time.Duration
ReconnectDelay time.Duration ReconnectDelay time.Duration
MaxQueueSize int
LoggingEnabled bool LoggingEnabled bool
LogLevel *slog.Level LogLevel *slog.Level
} }
@@ -179,7 +178,6 @@ func GetDefaultWorkerConfig() *WorkerConfig {
return &WorkerConfig{ return &WorkerConfig{
KeepaliveTimeout: 60 * time.Second, KeepaliveTimeout: 60 * time.Second,
ReconnectDelay: 2 * time.Second, ReconnectDelay: 2 * time.Second,
MaxQueueSize: 0, // disabled by default
LoggingEnabled: true, LoggingEnabled: true,
LogLevel: nil, LogLevel: nil,
} }
@@ -200,18 +198,6 @@ func ValidateWorkerConfig(config *WorkerConfig) error {
return err return err
} }
err = validateMaxQueueSize(config.MaxQueueSize)
if err != nil {
return err
}
return nil
}
func validateMaxQueueSize(value int) error {
if value < 0 {
return InvalidMaxQueueSize
}
return nil return nil
} }
@@ -252,18 +238,6 @@ func WithReconnectDelay(value time.Duration) WorkerOption {
} }
} }
// When MaxQueueSize is set to zero, queue limits are disabled.
func WithMaxQueueSize(value int) WorkerOption {
return func(c *WorkerConfig) error {
err := validateMaxQueueSize(value)
if err != nil {
return err
}
c.MaxQueueSize = value
return nil
}
}
func WithWorkerLoggingEnabled(value bool) WorkerOption { func WithWorkerLoggingEnabled(value bool) WorkerOption {
return func(c *WorkerConfig) error { return func(c *WorkerConfig) error {
c.LoggingEnabled = value c.LoggingEnabled = value
-8
View File
@@ -23,13 +23,11 @@ type Worker interface {
type WorkerStats struct { type WorkerStats struct {
IncomingAvailable bool IncomingAvailable bool
ChanIncoming int ChanIncoming int
BufferDepth int64
ConnectionAvailable bool ConnectionAvailable bool
Connection transport.ConnectionStats Connection transport.ConnectionStats
TotalProcessed uint64 TotalProcessed uint64
TotalDropped uint64
TotalSent uint64 TotalSent uint64
TotalRestarts uint64 TotalRestarts uint64
} }
@@ -41,10 +39,8 @@ type DefaultWorker struct {
heartbeat chan struct{} heartbeat chan struct{}
processedCount *atomic.Uint64 processedCount *atomic.Uint64
droppedCount *atomic.Uint64
outgoingCount *atomic.Uint64 outgoingCount *atomic.Uint64
restartCount *atomic.Uint64 restartCount *atomic.Uint64
bufferDepth *atomic.Int64
config *WorkerConfig config *WorkerConfig
ctx context.Context ctx context.Context
@@ -71,10 +67,8 @@ func NewWorker(
config: config, config: config,
heartbeat: make(chan struct{}), heartbeat: make(chan struct{}),
processedCount: &atomic.Uint64{}, processedCount: &atomic.Uint64{},
droppedCount: &atomic.Uint64{},
outgoingCount: &atomic.Uint64{}, outgoingCount: &atomic.Uint64{},
restartCount: &atomic.Uint64{}, restartCount: &atomic.Uint64{},
bufferDepth: &atomic.Int64{},
ctx: wctx, ctx: wctx,
cancel: wcancel, cancel: wcancel,
logger: logger, logger: logger,
@@ -176,13 +170,11 @@ func (w *DefaultWorker) Stats() WorkerStats {
return WorkerStats{ return WorkerStats{
IncomingAvailable: connectionAvailable, IncomingAvailable: connectionAvailable,
ChanIncoming: incomingLen, ChanIncoming: incomingLen,
BufferDepth: w.bufferDepth.Load(),
ConnectionAvailable: connectionAvailable, ConnectionAvailable: connectionAvailable,
Connection: connStats, Connection: connStats,
TotalProcessed: w.processedCount.Load(), TotalProcessed: w.processedCount.Load(),
TotalDropped: w.droppedCount.Load(),
TotalRestarts: w.restartCount.Load(), TotalRestarts: w.restartCount.Load(),
TotalSent: w.outgoingCount.Load(), TotalSent: w.outgoingCount.Load(),
} }