mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd/swarm: run chunk debug on success and failure
This commit is contained in:
parent
d972357ca1
commit
7e113d44e7
1 changed files with 8 additions and 15 deletions
|
|
@ -52,32 +52,25 @@ func uploadAndSyncCmd(ctx *cli.Context, tuid string) error {
|
||||||
errc <- uploadAndSync(ctx, randomBytes, tuid)
|
errc <- uploadAndSync(ctx, randomBytes, tuid)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
var err error
|
||||||
select {
|
select {
|
||||||
case err := <-errc:
|
case err = <-errc:
|
||||||
if err != nil {
|
if err != nil {
|
||||||
metrics.GetOrRegisterCounter(fmt.Sprintf("%s.fail", commandName), nil).Inc(1)
|
metrics.GetOrRegisterCounter(fmt.Sprintf("%s.fail", commandName), nil).Inc(1)
|
||||||
}
|
}
|
||||||
return err
|
|
||||||
case <-time.After(time.Duration(timeout) * time.Second):
|
case <-time.After(time.Duration(timeout) * time.Second):
|
||||||
metrics.GetOrRegisterCounter(fmt.Sprintf("%s.timeout", commandName), nil).Inc(1)
|
metrics.GetOrRegisterCounter(fmt.Sprintf("%s.timeout", commandName), nil).Inc(1)
|
||||||
|
|
||||||
e := fmt.Errorf("timeout after %v sec", timeout)
|
err = fmt.Errorf("timeout after %v sec", timeout)
|
||||||
|
}
|
||||||
|
|
||||||
// trigger debug functionality on randomBytes
|
// trigger debug functionality on randomBytes
|
||||||
err := trackChunks(randomBytes[:])
|
e := trackChunks(randomBytes[:])
|
||||||
if err != nil {
|
if e != nil {
|
||||||
e = fmt.Errorf("%v; triggerChunkDebug failed: %v", e, err)
|
log.Error(e.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
return e
|
return err
|
||||||
}
|
|
||||||
|
|
||||||
// trigger debug functionality on randomBytes even on successful runs
|
|
||||||
err := trackChunks(randomBytes[:])
|
|
||||||
if err != nil {
|
|
||||||
log.Error(err.Error())
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func trackChunks(testData []byte) error {
|
func trackChunks(testData []byte) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue