lpseal: Fix poller
This commit is contained in:
parent
5d26c3a9dc
commit
04f5a595e4
@ -67,8 +67,8 @@ create table sectors_sdr_pipeline (
|
||||
-- Failure handling
|
||||
failed bool not null default false,
|
||||
failed_at timestamp,
|
||||
failed_reason varchar(20),
|
||||
failed_reason_msg text,
|
||||
failed_reason varchar(20) not null default '',
|
||||
failed_reason_msg text not null default '',
|
||||
|
||||
-- constraints
|
||||
primary key (sp_id, sector_number)
|
||||
|
@ -42,7 +42,7 @@ func (s *SealPoller) RunPoller(ctx context.Context) {
|
||||
return
|
||||
case <-ticker.C:
|
||||
if err := s.poll(ctx); err != nil {
|
||||
log.Errorf("polling sdr sector pipeline: %w", err)
|
||||
log.Errorw("polling failed", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,7 +84,19 @@ func (s *SealPoller) poll(ctx context.Context) error {
|
||||
FailedReason string `db:"failed_reason"`
|
||||
}
|
||||
|
||||
err := s.db.Select(ctx, &tasks, `SELECT * FROM sectors_sdr_pipeline WHERE after_commit_msg_success != true`)
|
||||
err := s.db.Select(ctx, &tasks, `SELECT
|
||||
sp_id, sector_number,
|
||||
task_id_sdr, after_sdr,
|
||||
task_id_tree_d, after_tree_d,
|
||||
task_id_tree_c, after_tree_c,
|
||||
task_id_tree_r, after_tree_r,
|
||||
task_id_precommit_msg, after_precommit_msg,
|
||||
task_id_precommit_msg_wait, after_precommit_msg_success,
|
||||
task_id_porep, porep_proof,
|
||||
task_id_commit_msg, after_commit_msg,
|
||||
task_id_commit_msg_wait, after_commit_msg_success,
|
||||
failed, failed_reason
|
||||
FROM sectors_sdr_pipeline WHERE after_commit_msg_success != true`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -107,13 +107,13 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
|
||||
// First query to fetch from mining_tasks
|
||||
err = t.db.QueryRow(ctx, `SELECT sp_id, epoch, base_compute_time FROM mining_tasks WHERE task_id = $1`, taskID).Scan(&details.SpID, &details.Epoch, &details.CompTime)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, xerrors.Errorf("query mining base info fail: %w", err)
|
||||
}
|
||||
|
||||
// Second query to fetch from mining_base_block
|
||||
rows, err := t.db.Query(ctx, `SELECT block_cid FROM mining_base_block WHERE task_id = $1`, taskID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, xerrors.Errorf("query mining base blocks fail: %w", err)
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
@ -126,7 +126,7 @@ func (t *WinPostTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (don
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
return false, err
|
||||
return false, xerrors.Errorf("query mining base blocks fail (rows.Err): %w", err)
|
||||
}
|
||||
|
||||
// construct base
|
||||
|
Loading…
Reference in New Issue
Block a user