Skip to content

Commit

Permalink
Merge pull request #1440 from 0chain/feat/data-log
Browse files Browse the repository at this point in the history
add logs for data size in challenge
  • Loading branch information
dabasov authored Jun 8, 2024
2 parents 132b212 + a107b9d commit d2ced01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/go/0chain.net/blobbercore/challenge/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (cr *ChallengeEntity) LoadValidationTickets(ctx context.Context) error {
allocMu.RUnlock()

postDataBytes, err := json.Marshal(postData)
logging.Logger.Info("[challenge]post: ", zap.Any("challenge_id", cr.ChallengeID), zap.Any("post_data_len", len(postData)/(1024*1024)))
logging.Logger.Info("[challenge]post: ", zap.Any("challenge_id", cr.ChallengeID), zap.Any("post_data_len", len(postDataBytes)/(1024*1024)))
if err != nil {
logging.Logger.Error("[db]form: " + err.Error())
cr.CancelChallenge(ctx, err)
Expand Down
6 changes: 3 additions & 3 deletions code/go/0chain.net/core/util/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"go.uber.org/zap"
)

const MAX_RETRIES = 5
const MAX_RETRIES = 3
const SLEEP_BETWEEN_RETRIES = 5

func NewHTTPRequest(method, url string, data []byte) (*http.Request, context.Context, context.CancelFunc, error) {
Expand All @@ -27,7 +27,7 @@ func NewHTTPRequest(method, url string, data []byte) (*http.Request, context.Con
req.Header.Set("X-App-Client-ID", node.Self.ID)
req.Header.Set("X-App-Client-Key", node.Self.PublicKey)
req.Header.Set("X-App-Request-Hash", requestHash)
ctx, cncl := context.WithTimeout(context.Background(), time.Second*60)
ctx, cncl := context.WithTimeout(context.Background(), time.Second*90)
return req, ctx, cncl, err
}

Expand Down Expand Up @@ -71,7 +71,7 @@ func SendPostRequest(url string, data []byte, wg *sync.WaitGroup) (body []byte,
time.Sleep(SLEEP_BETWEEN_RETRIES * time.Second)
}
if resp == nil || err != nil {
Logger.Error("Failed after multiple retries", zap.Any("url", url), zap.Int("retried", MAX_RETRIES), zap.Error(err))
Logger.Error("Failed after multiple retries", zap.Any("url", url), zap.Int("retried", MAX_RETRIES), zap.Int("post_data_len", len(data)), zap.Error(err))
return nil, err
}
if resp.Body == nil {
Expand Down

0 comments on commit d2ced01

Please sign in to comment.