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

Method queueIndexBatch

queue.go:110–129  ·  view source on GitHub ↗

queueIndexBatch enqueues a batch of items to be indexed in dependency order. This ensures that dependencies (e.g., balances) are indexed before the primary item (e.g., transaction). Uses the same IndexQueue but with a different task type for routing. Parameters: - batch interface{}: The batch conta

(batch interface{})

Source from the content-addressed store, hash-verified

108// Returns:
109// - error: An error if the task could not be enqueued.
110func (q *Queue) queueIndexBatch(batch interface{}) error {
111 if q.config.TypeSense.Dns == "" {
112 return nil
113 }
114
115 payload, err := json.Marshal(batch)
116 if err != nil {
117 return err
118 }
119
120 taskOptions := []asynq.Option{asynq.Queue(q.config.Queue.IndexQueue)}
121 task := asynq.NewTask("new:index:batch", payload, taskOptions...)
122 _, err = q.Client.Enqueue(task)
123 if err != nil {
124 logrus.WithError(err).Error("failed to enqueue index batch")
125 return err
126 }
127 logrus.Debug("successfully enqueued index batch")
128 return nil
129}
130
131// queueIndexData enqueues a task to index data in a specified collection.
132//

Callers 1

Calls 3

EnqueueMethod · 0.80
ErrorMethod · 0.45
DebugMethod · 0.45

Tested by

no test coverage detected