MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / transactionQueueName

Method transactionQueueName

queue.go:237–252  ·  view source on GitHub ↗
(transaction *model.Transaction)

Source from the content-addressed store, hash-verified

235}
236
237func (q *Queue) transactionQueueName(transaction *model.Transaction) string {
238 if q.config.Queue.EnableHotLane && transaction != nil && transaction.MetaData != nil {
239 if hotpairs.QueueLaneFromMetadata(transaction.MetaData) == hotpairs.LaneHot {
240 metrics.HotpairsLaneRoutedTotal.Add(context.Background(), 1,
241 otelmetric.WithAttributes(attribute.String("lane", "hot")),
242 )
243 return q.config.Queue.HotQueueName
244 }
245 }
246
247 metrics.HotpairsLaneRoutedTotal.Add(context.Background(), 1,
248 otelmetric.WithAttributes(attribute.String("lane", "normal")),
249 )
250 queueIndex := hashBalanceID(transaction.Source) % q.config.Queue.NumberOfQueues
251 return fmt.Sprintf("%s_%d", q.config.Queue.TransactionQueue, queueIndex+1)
252}
253
254// hashBalanceID returns a consistent hash value for a string balance ID.
255//

Callers 1

geTaskMethod · 0.95

Calls 2

QueueLaneFromMetadataFunction · 0.92
hashBalanceIDFunction · 0.85

Tested by

no test coverage detected