diff --git a/node/pkg/admin/host/controller.go b/node/pkg/admin/host/controller.go index 36937cdf9..7551e1247 100644 --- a/node/pkg/admin/host/controller.go +++ b/node/pkg/admin/host/controller.go @@ -23,7 +23,7 @@ func getPeerCount(c *fiber.Ctx) error { } func sync(c *fiber.Ctx) error { - msg, err := utils.SendMessage(c, bus.LIBP2P, bus.SYNC, nil) + msg, err := utils.SendMessage(c, bus.LIBP2P, bus.LIBP2P_SYNC, nil) if err != nil { log.Error().Err(err).Str("Player", "Admin").Msg("failed to send message to libp2p helper") return c.Status(fiber.StatusInternalServerError).SendString("failed to sync libp2p host: " + err.Error()) diff --git a/node/pkg/admin/tests/host_test.go b/node/pkg/admin/tests/host_test.go index e94ef61a6..201e627f6 100644 --- a/node/pkg/admin/tests/host_test.go +++ b/node/pkg/admin/tests/host_test.go @@ -38,7 +38,7 @@ func TestSync(t *testing.T) { defer cleanup() channel := testItems.mb.Subscribe(bus.LIBP2P) - waitForMessage(t, channel, bus.ADMIN, bus.LIBP2P, bus.SYNC) + waitForMessage(t, channel, bus.ADMIN, bus.LIBP2P, bus.LIBP2P_SYNC) result, err := RawPostRequest(testItems.app, "/api/v1/host/sync", nil) if err != nil { diff --git a/node/pkg/bus/types.go b/node/pkg/bus/types.go index 00442ce77..669644dbf 100644 --- a/node/pkg/bus/types.go +++ b/node/pkg/bus/types.go @@ -34,5 +34,5 @@ const ( REFRESH_REPORTER = "refresh_reporter" GET_PEER_COUNT = "get_peer_count" - SYNC = "sync" + LIBP2P_SYNC = "libp2p_sync" ) diff --git a/node/pkg/libp2p/helper/app.go b/node/pkg/libp2p/helper/app.go index fe85d0eda..9262154bc 100644 --- a/node/pkg/libp2p/helper/app.go +++ b/node/pkg/libp2p/helper/app.go @@ -75,7 +75,7 @@ func (a *App) handleMessage(ctx context.Context, msg bus.Message) { log.Debug().Str("Player", "Libp2pHelper").Msg("get peer count msg received") peerCount := len(a.Host.Network().Peers()) msg.Response <- bus.MessageResponse{Success: true, Args: map[string]any{"Count": peerCount}} - case bus.SYNC: + case bus.LIBP2P_SYNC: log.Debug().Str("Player", "Libp2pHelper").Msg("libp2p sync msg received") err := setup.ConnectThroughBootApi(ctx, a.Host) if err != nil { diff --git a/node/taskfiles/taskfile.local.yml b/node/taskfiles/taskfile.local.yml index 603c0b425..4cf633f59 100644 --- a/node/taskfiles/taskfile.local.yml +++ b/node/taskfiles/taskfile.local.yml @@ -183,7 +183,7 @@ tasks: renew-signer: dotenv: [".env"] cmds: - - curl -X POST "http://localhost:$APP_PORT/api/v1/aggregator/renew-signer" | jq + - curl -X POST "http://localhost:$APP_PORT/api/v1/aggregator/renew-signer" add-json-rpc: dotenv: [".env"] cmds: @@ -201,6 +201,14 @@ tasks: dotenv: [".env"] cmds: - curl -X GET "http://localhost:$APP_PORT/api/v1/provider-url" | jq + get-peer-count: + dotenv: [".env"] + cmds: + - curl -X GET "http://localhost:$APP_PORT/api/v1/host/peercount" | jq + sync-libp2p: + dotenv: [".env"] + cmds: + - curl -X POST "http://localhost:$APP_PORT/api/v1/host/sync" test: cmds: - task: test-db