(cfg Config, logger log.Logger, fn ProcessFunc[T])
| 59 | } |
| 60 | |
| 61 | func New[T any](cfg Config, logger log.Logger, fn ProcessFunc[T]) *Queue[T] { |
| 62 | return &Queue[T]{ |
| 63 | logger: logger, |
| 64 | name: cfg.Name, |
| 65 | tenantID: cfg.TenantID, |
| 66 | workerCount: cfg.WorkerCount, |
| 67 | size: cfg.Size, |
| 68 | reqChan: make(chan T, cfg.Size), |
| 69 | fn: fn, |
| 70 | workersCloseCh: make(chan struct{}), |
| 71 | pushesTotalMetrics: pushesTotalMetrics, |
| 72 | pushesFailuresTotalMetrics: pushesFailuresTotalMetric, |
| 73 | lengthMetric: lengthMetric, |
| 74 | readOnly: &atomic.Bool{}, |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | // Push pushes data onto a queue. |
| 79 | // If the queue is full, the data is dropped |
no outgoing calls