Commit d2b626a3 authored by Mark Tyneway's avatar Mark Tyneway Committed by Liam Horne

syncservice: nit

parent 7e04137d
...@@ -129,28 +129,28 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co ...@@ -129,28 +129,28 @@ func NewSyncService(ctx context.Context, cfg Config, txpool *core.TxPool, bc *co
if service.enable { if service.enable {
// Ensure that the rollup client can connect to a remote server // Ensure that the rollup client can connect to a remote server
// before starting. Retry until it can connect. // before starting. Retry until it can connect.
t1 := time.NewTicker(10 * time.Second) tEnsure := time.NewTicker(10 * time.Second)
for ; true; <-t1.C { for ; true; <-tEnsure.C {
err := service.ensureClient() err := service.ensureClient()
if err != nil { if err != nil {
log.Info("Cannot connect to upstream service", "msg", err) log.Info("Cannot connect to upstream service", "msg", err)
} else { } else {
log.Info("Connected to upstream service") log.Info("Connected to upstream service")
t1.Stop() tEnsure.Stop()
break break
} }
} }
// Wait until the remote service is done syncing // Wait until the remote service is done syncing
t2 := time.NewTicker(10 * time.Second) tStatus := time.NewTicker(10 * time.Second)
for ; true; <-t2.C { for ; true; <-tStatus.C {
status, err := service.client.SyncStatus(service.backend) status, err := service.client.SyncStatus(service.backend)
if err != nil { if err != nil {
log.Error("Cannot get sync status") log.Error("Cannot get sync status")
continue continue
} }
if !status.Syncing { if !status.Syncing {
t2.Stop() tStatus.Stop()
break break
} }
log.Info("Still syncing", "index", status.CurrentTransactionIndex, "tip", status.HighestKnownTransactionIndex) log.Info("Still syncing", "index", status.CurrentTransactionIndex, "tip", status.HighestKnownTransactionIndex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment