Skip to content

Commit d2ced01

Browse files
authored
Merge pull request #1440 from 0chain/feat/data-log
add logs for data size in challenge
2 parents 132b212 + a107b9d commit d2ced01

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

code/go/0chain.net/blobbercore/challenge/protocol.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func (cr *ChallengeEntity) LoadValidationTickets(ctx context.Context) error {
223223
allocMu.RUnlock()
224224

225225
postDataBytes, err := json.Marshal(postData)
226-
logging.Logger.Info("[challenge]post: ", zap.Any("challenge_id", cr.ChallengeID), zap.Any("post_data_len", len(postData)/(1024*1024)))
226+
logging.Logger.Info("[challenge]post: ", zap.Any("challenge_id", cr.ChallengeID), zap.Any("post_data_len", len(postDataBytes)/(1024*1024)))
227227
if err != nil {
228228
logging.Logger.Error("[db]form: " + err.Error())
229229
cr.CancelChallenge(ctx, err)

code/go/0chain.net/core/util/http.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"go.uber.org/zap"
1717
)
1818

19-
const MAX_RETRIES = 5
19+
const MAX_RETRIES = 3
2020
const SLEEP_BETWEEN_RETRIES = 5
2121

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

@@ -71,7 +71,7 @@ func SendPostRequest(url string, data []byte, wg *sync.WaitGroup) (body []byte,
7171
time.Sleep(SLEEP_BETWEEN_RETRIES * time.Second)
7272
}
7373
if resp == nil || err != nil {
74-
Logger.Error("Failed after multiple retries", zap.Any("url", url), zap.Int("retried", MAX_RETRIES), zap.Error(err))
74+
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))
7575
return nil, err
7676
}
7777
if resp.Body == nil {

0 commit comments

Comments
 (0)