From a5972b040e52ae9664bb5ee1ad0e421f1baa6702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Mon, 6 Jan 2025 15:46:05 +0100 Subject: [PATCH] fix: Batching Hotfixes (#351) --- harmony/harmonydb/sql/20241210-sdr-batching.sql | 3 +++ tasks/seal/poller.go | 8 +++++--- tasks/snap/task_submit.go | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/harmony/harmonydb/sql/20241210-sdr-batching.sql b/harmony/harmonydb/sql/20241210-sdr-batching.sql index 3f39a3e08..41f7b44e0 100644 --- a/harmony/harmonydb/sql/20241210-sdr-batching.sql +++ b/harmony/harmonydb/sql/20241210-sdr-batching.sql @@ -1,6 +1,9 @@ ALTER TABLE sectors_sdr_pipeline ADD COLUMN precommit_ready_at TIMESTAMPTZ; ALTER TABLE sectors_sdr_pipeline ADD COLUMN commit_ready_at TIMESTAMPTZ; +UPDATE sectors_sdr_pipeline SET precommit_ready_at = CURRENT_TIMESTAMP AT TIME ZONE 'UTC' WHERE after_tree_r = TRUE; +UPDATE sectors_sdr_pipeline SET commit_ready_at = CURRENT_TIMESTAMP AT TIME ZONE 'UTC' WHERE after_porep = TRUE; + -- Function to precommit_ready_at value. Used by the trigger CREATE OR REPLACE FUNCTION set_precommit_ready_at() RETURNS TRIGGER AS $$ diff --git a/tasks/seal/poller.go b/tasks/seal/poller.go index 183961785..1c22b739f 100644 --- a/tasks/seal/poller.go +++ b/tasks/seal/poller.go @@ -5,6 +5,7 @@ import ( "time" logging "github.com/ipfs/go-log/v2" + "github.com/samber/lo" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" @@ -238,11 +239,12 @@ func (s *SealPoller) poll(ctx context.Context) error { return err } + tasks = lo.Filter(tasks, func(t pollTask, _ int) bool { + return !t.Failed + }) + for _, task := range tasks { task := task - if task.Failed { - continue - } ts, err := s.api.ChainHead(ctx) if err != nil { diff --git a/tasks/snap/task_submit.go b/tasks/snap/task_submit.go index 95d5255a3..1f8014fa2 100644 --- a/tasks/snap/task_submit.go +++ b/tasks/snap/task_submit.go @@ -502,7 +502,7 @@ func (s *SubmitTask) CanAccept(ids []harmonytask.TaskID, engine *harmonytask.Tas func (s *SubmitTask) TypeDetails() harmonytask.TaskTypeDetails { return harmonytask.TaskTypeDetails{ - Name: "BatchUpdateSubmit", + Name: "UpdateBatch", Cost: resources.Resources{ Cpu: 1, Ram: 64 << 20,