Skip to content

Commit

Permalink
fix psd wait time column (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr authored Feb 17, 2025
1 parent 646c67f commit 5bb0bb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
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

0 comments on commit 5bb0bb3

Please sign in to comment.