lpseal: Appease the linter

This commit is contained in:
Łukasz Magiera 2024-02-12 15:14:40 +01:00
parent 3c4c286eeb
commit f2f1cc30ec
5 changed files with 19 additions and 4 deletions

View File

@ -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()
},
}

View File

@ -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

View File

@ -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))
}

View File

@ -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
}

View File

@ -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,