From b11b6de0557d7fa1df1e70757d3f91f1703399e7 Mon Sep 17 00:00:00 2001 From: sh-cha Date: Wed, 22 Jan 2025 14:19:49 +0900 Subject: [PATCH 1/2] change syncing query logic --- challenger/challenger.go | 2 +- executor/querier.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/challenger/challenger.go b/challenger/challenger.go index 35ee52d..b3864aa 100644 --- a/challenger/challenger.go +++ b/challenger/challenger.go @@ -231,7 +231,7 @@ func (c *Challenger) RegisterQuerier() { if err != nil { return err } - return ctx.JSON(*status.Host.Node.Syncing && *status.Child.Node.Syncing) + return ctx.JSON(*status.Host.Node.Syncing || *status.Child.Node.Syncing) }) } diff --git a/executor/querier.go b/executor/querier.go index 2cacf34..e77bf90 100644 --- a/executor/querier.go +++ b/executor/querier.go @@ -74,6 +74,6 @@ func (ex *Executor) RegisterQuerier() { hostSync := status.Host.Node.Syncing != nil && *status.Host.Node.Syncing childSync := status.Child.Node.Syncing != nil && *status.Child.Node.Syncing batchSync := status.BatchSubmitter.Node.Syncing != nil && *status.BatchSubmitter.Node.Syncing - return c.JSON(hostSync && childSync && batchSync) + return c.JSON(hostSync || childSync || batchSync) }) } From 13cdaf75a866b8702002cdb334f347d361aa9d52 Mon Sep 17 00:00:00 2001 From: Hoon <48665813+sh-cha@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:44:41 +0900 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- challenger/challenger.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/challenger/challenger.go b/challenger/challenger.go index b3864aa..7dedf0b 100644 --- a/challenger/challenger.go +++ b/challenger/challenger.go @@ -231,7 +231,9 @@ func (c *Challenger) RegisterQuerier() { if err != nil { return err } - return ctx.JSON(*status.Host.Node.Syncing || *status.Child.Node.Syncing) + hostSync := status.Host.Node.Syncing != nil && *status.Host.Node.Syncing + childSync := status.Child.Node.Syncing != nil && *status.Child.Node.Syncing + return ctx.JSON(hostSync || childSync) }) }