Skip to content

Commit cb9bae5

Browse files
authored
fix batch size (#836)
1 parent 298c43f commit cb9bae5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

task/processor/processor.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,22 @@ func (r *processor) run() {
154154
continue
155155
}
156156
deviceTasks := []*task.Task{}
157+
processTaskIDs := []common.Hash{}
158+
i := uint64(0)
157159
for _, t := range deviceTaskM {
160+
if i >= batch {
161+
break
162+
}
163+
i++
158164
deviceTasks = append(deviceTasks, t)
165+
processTaskIDs = append(processTaskIDs, t.ID)
159166
}
160167

161168
err = r.process(deviceTasks, c, pid)
162169
if err != nil {
163170
slog.Error("failed to process task", "error", err)
164171
}
165-
if err := r.db.ProcessTasks(taskIDs, err); err != nil {
172+
if err := r.db.ProcessTasks(processTaskIDs, err); err != nil {
166173
slog.Error("failed to process db tasks", "error", err)
167174
}
168175
}

0 commit comments

Comments
 (0)