diff --git a/cmd/lotus-shed/lpdeal.go b/cmd/lotus-shed/lpdeal.go index 28b631fda..43d23f597 100644 --- a/cmd/lotus-shed/lpdeal.go +++ b/cmd/lotus-shed/lpdeal.go @@ -559,6 +559,14 @@ var lpBoostProxyCmd = &cli.Command{ fmt.Printf("Token: %s:%s\n", tok, ma) } - return http.ListenAndServe(cctx.String("listen"), mux) + server := &http.Server{ + Addr: cctx.String("listen"), + Handler: mux, + ReadTimeout: 15 * time.Second, + WriteTimeout: 48 * time.Hour, // really high because we block until TreeD + IdleTimeout: 60 * time.Second, + } + + return server.ListenAndServe() }, } diff --git a/provider/lpproof/treed_build.go b/provider/lpproof/treed_build.go index 00d13114c..bf91da8c8 100644 --- a/provider/lpproof/treed_build.go +++ b/provider/lpproof/treed_build.go @@ -22,7 +22,6 @@ import ( const nodeSize = 32 const threadChunkSize = 1 << 20 -const nodesPerChunk = threadChunkSize / nodeSize func hashChunk(data [][]byte) { l1Nodes := len(data[0]) / nodeSize / 2 diff --git a/provider/lpseal/poller_commit_msg.go b/provider/lpseal/poller_commit_msg.go index bbdc85039..a70b709bc 100644 --- a/provider/lpseal/poller_commit_msg.go +++ b/provider/lpseal/poller_commit_msg.go @@ -83,7 +83,7 @@ func (s *SealPoller) pollCommitMsgFail(ctx context.Context, task pollTask, execR fallthrough case exitcode.SysErrOutOfGas: // just retry - return s.pollRetryPrecommitMsgSend(ctx, task, execResult) + return s.pollRetryCommitMsgSend(ctx, task, execResult) default: return xerrors.Errorf("commit message failed with exit code %s", exitcode.ExitCode(execResult.ExecutedRcptExitCode)) } diff --git a/provider/lpseal/task_movestorage.go b/provider/lpseal/task_movestorage.go index d168e49ee..aa16d08e9 100644 --- a/provider/lpseal/task_movestorage.go +++ b/provider/lpseal/task_movestorage.go @@ -64,6 +64,9 @@ func (m *MoveStorageTask) Do(taskID harmonytask.TaskID, stillOwned func() bool) } _, err = m.db.Exec(ctx, `update sectors_sdr_pipeline set after_move_storage=true where task_id_move_storage=$1`, taskID) + if err != nil { + return false, xerrors.Errorf("updating task: %w", err) + } return true, nil } diff --git a/provider/lpseal/task_trees_test.go b/provider/lpseal/task_trees_test.go index d9fd6c41e..204fa57fc 100644 --- a/provider/lpseal/task_trees_test.go +++ b/provider/lpseal/task_trees_test.go @@ -5,6 +5,8 @@ import ( "net/http" "net/http/httptest" "testing" + + "github.com/stretchr/testify/require" ) // TestUrlPieceReader_Read tests various scenarios of reading data from UrlPieceReader @@ -12,7 +14,8 @@ func TestUrlPieceReader_Read(t *testing.T) { // Create a test server testData := "This is a test string." ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - io.WriteString(w, testData) + _, err := io.WriteString(w, testData) + require.NoError(t, err) })) defer ts.Close() @@ -29,6 +32,8 @@ func TestUrlPieceReader_Read(t *testing.T) { } for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { reader := UrlPieceReader{ Url: ts.URL,