File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -566,6 +566,26 @@ func (p *Blox) Start(ctx context.Context) error {
566566 }
567567 }()
568568 go func () {
569+ // Wait for IPFS Cluster API to be reachable before calling RecoverAll.
570+ clusterReady := false
571+ for i := 0 ; i < 30 ; i ++ {
572+ select {
573+ case <- ctx .Done ():
574+ return
575+ default :
576+ }
577+ resp , err := http .Get ("http://127.0.0.1:9094/id" )
578+ if err == nil {
579+ resp .Body .Close ()
580+ clusterReady = true
581+ break
582+ }
583+ time .Sleep (5 * time .Second )
584+ }
585+ if ! clusterReady {
586+ log .Warn ("IPFS Cluster not reachable after waiting, skipping RecoverAll" )
587+ return
588+ }
569589 err := p .ipfsClusterApi .RecoverAll (ctx , true , recoverOut )
570590 if err != nil {
571591 log .Errorw ("RecoverAll error" , "err" , err .Error ())
You can’t perform that action at this time.
0 commit comments