Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: psd wait time column value when commP is skipped #416

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tasks/storage-market/storage_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ func (d *CurioStorageDealMarket) processMk12Deal(ctx context.Context, deal MK12P
if deal.Started && !deal.AfterCommp && deal.CommTaskID == nil {
// Skip commP is configured to do so
if d.cfg.Market.StorageMarketConfig.MK12.SkipCommP {
_, err := d.db.Exec(ctx, `UPDATE market_mk12_deal_pipeline SET after_commp = TRUE, commp_task_id = NULL WHERE uuid = $1`, deal.UUID)
_, err := d.db.Exec(ctx, `UPDATE market_mk12_deal_pipeline SET after_commp = TRUE, psd_wait_time = NOW(), commp_task_id = NULL WHERE uuid = $1`, deal.UUID)
if err != nil {
return xerrors.Errorf("UUID: %s: updating deal pipeline: %w", deal.UUID, err)
}
Expand Down
7 changes: 1 addition & 6 deletions tasks/storage-market/task_commp.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,19 +196,14 @@ func (c *CommpTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) (done
return false, xerrors.Errorf("commP mismatch calculated %s and supplied %s", pcid, calculatedCommp.PieceCID)
}

n, err := c.db.Exec(ctx, `UPDATE market_mk12_deal_pipeline SET after_commp = TRUE, commp_task_id = NULL WHERE commp_task_id = $1`, taskID)
n, err := c.db.Exec(ctx, `UPDATE market_mk12_deal_pipeline SET after_commp = TRUE, psd_wait_time = NOW(), commp_task_id = NULL WHERE commp_task_id = $1`, taskID)
if err != nil {
return false, xerrors.Errorf("store commp success: updating deal pipeline: %w", err)
}
if n != 1 {
return false, xerrors.Errorf("store commp success: updated %d rows", n)
}

_, err = c.db.Exec(ctx, `UPDATE market_mk12_deal_pipeline SET psd_wait_time = NOW() AT TIME ZONE 'UTC' WHERE uuid = $1`, piece.UUID)
if err != nil {
return false, xerrors.Errorf("store psd time: updating deal pipeline: %w", err)
}

return true, nil
}

Expand Down