NewQueuedTransactionRecoveryProcessor creates the stuck queued-transaction recovery loop with conservative single-worker defaults to avoid recovery-induced lock storms.
(ledgerforge *LedgerForge)
| 45 | // NewQueuedTransactionRecoveryProcessor creates the stuck queued-transaction recovery loop |
| 46 | // with conservative single-worker defaults to avoid recovery-induced lock storms. |
| 47 | func NewQueuedTransactionRecoveryProcessor(ledgerforge *LedgerForge) *QueuedTransactionRecoveryProcessor { |
| 48 | return &QueuedTransactionRecoveryProcessor{ |
| 49 | ledgerforge: ledgerforge, |
| 50 | batchSize: 100, |
| 51 | maxWorkers: 1, |
| 52 | pollInterval: 30 * time.Second, |
| 53 | stuckThreshold: 2 * time.Hour, |
| 54 | maxRecoveryAttempts: 3, |
| 55 | stopCh: make(chan struct{}), |
| 56 | processQueuedTransaction: ledgerforge.processQueuedTransaction, |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Start begins the background recovery loop for stuck queued transactions. |
| 61 | func (p *QueuedTransactionRecoveryProcessor) Start(ctx context.Context) { |
no outgoing calls