Skip to content

Commit

Permalink
rm unused node dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
FZambia committed Jan 7, 2025
1 parent 30d0443 commit bc02113
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 19 deletions.
12 changes: 6 additions & 6 deletions internal/client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ func (h *Handler) Setup() error {
if h.proxyMap.ConnectProxy != nil {
connectProxyHandler = proxy.NewConnectHandler(proxy.ConnectHandlerConfig{
Proxy: h.proxyMap.ConnectProxy,
}, h.cfgContainer).Handle(h.node)
}, h.cfgContainer).Handle()
}

var refreshProxyHandler proxy.RefreshHandlerFunc
if h.proxyMap.RefreshProxy != nil {
refreshProxyHandler = proxy.NewRefreshHandler(proxy.RefreshHandlerConfig{
Proxy: h.proxyMap.RefreshProxy,
}).Handle(h.node)
}).Handle()
}

h.node.OnConnecting(func(ctx context.Context, e centrifuge.ConnectEvent) (centrifuge.ConnectReply, error) {
Expand All @@ -95,7 +95,7 @@ func (h *Handler) Setup() error {
if len(h.proxyMap.RpcProxies) > 0 {
rpcProxyHandler = proxy.NewRPCHandler(proxy.RPCHandlerConfig{
Proxies: h.proxyMap.RpcProxies,
}).Handle(h.node)
}).Handle()
}

var publishProxyHandler proxy.PublishHandlerFunc
Expand All @@ -109,21 +109,21 @@ func (h *Handler) Setup() error {
if len(h.proxyMap.SubscribeProxies) > 0 {
subscribeProxyHandler = proxy.NewSubscribeHandler(proxy.SubscribeHandlerConfig{
Proxies: h.proxyMap.SubscribeProxies,
}).Handle(h.node)
}).Handle()
}

var proxySubscribeStreamHandler proxy.SubscribeStreamHandlerFunc
if len(h.proxyMap.SubscribeStreamProxies) > 0 {
proxySubscribeStreamHandler = proxy.NewSubscribeStreamHandler(proxy.SubscribeStreamHandlerConfig{
Proxies: h.proxyMap.SubscribeStreamProxies,
}).Handle(h.node)
}).Handle()
}

var subRefreshProxyHandler proxy.SubRefreshHandlerFunc
if len(h.proxyMap.SubRefreshProxies) > 0 {
subRefreshProxyHandler = proxy.NewSubRefreshHandler(proxy.SubRefreshHandlerConfig{
Proxies: h.proxyMap.SubRefreshProxies,
}).Handle(h.node)
}).Handle()
}

cfg := h.cfgContainer.Config()
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/connect_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ConnectExtra struct {
type ConnectingHandlerFunc func(context.Context, centrifuge.ConnectEvent) (centrifuge.ConnectReply, ConnectExtra, error)

// Handle returns connecting handler func.
func (h *ConnectHandler) Handle(node *centrifuge.Node) ConnectingHandlerFunc {
func (h *ConnectHandler) Handle() ConnectingHandlerFunc {
return func(ctx context.Context, e centrifuge.ConnectEvent) (centrifuge.ConnectReply, ConnectExtra, error) {
started := time.Now()
h.inflight.Inc()
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/connect_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (c connHandleTestCase) invokeHandle(ctx context.Context) (reply centrifuge.
Transport: tools.NewTestTransport(),
}

connHandler := c.connectProxyHandler.Handle(c.node)
connHandler := c.connectProxyHandler.Handle()
reply, _, err = connHandler(ctx, connectEvent)

return reply, err
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/refresh_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type RefreshExtra struct {
type RefreshHandlerFunc func(Client, centrifuge.RefreshEvent, PerCallData) (centrifuge.RefreshReply, RefreshExtra, error)

// Handle refresh.
func (h *RefreshHandler) Handle(node *centrifuge.Node) RefreshHandlerFunc {
func (h *RefreshHandler) Handle() RefreshHandlerFunc {
return func(client Client, e centrifuge.RefreshEvent, pcd PerCallData) (centrifuge.RefreshReply, RefreshExtra, error) {
started := time.Now()
h.inflight.Inc()
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/refresh_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type refreshHandleTestCase struct {
}

func (c refreshHandleTestCase) invokeHandle() (reply centrifuge.RefreshReply, err error) {
refreshHandler := c.refreshProxyHandler.Handle(c.node)
refreshHandler := c.refreshProxyHandler.Handle()
reply, _, err = refreshHandler(c.client, centrifuge.RefreshEvent{}, PerCallData{})

return reply, err
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/rpc_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func NewRPCHandler(c RPCHandlerConfig) *RPCHandler {
type RPCHandlerFunc func(Client, centrifuge.RPCEvent, *config.Container, PerCallData) (centrifuge.RPCReply, error)

// Handle RPC.
func (h *RPCHandler) Handle(node *centrifuge.Node) RPCHandlerFunc {
func (h *RPCHandler) Handle() RPCHandlerFunc {
return func(client Client, e centrifuge.RPCEvent, cfgContainer *config.Container, pcd PerCallData) (centrifuge.RPCReply, error) {
started := time.Now()

Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/rpc_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type rpcHandleTestCase struct {
}

func (c rpcHandleTestCase) invokeHandle() (reply centrifuge.RPCReply, err error) {
rpcHandler := c.rpcProxyHandler.Handle(c.node)
rpcHandler := c.rpcProxyHandler.Handle()
cfg := config.DefaultConfig()
cfg.RPC = configtypes.RPC{
WithoutNamespace: configtypes.RpcOptions{
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/sub_refresh_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type SubRefreshExtra struct {
type SubRefreshHandlerFunc func(Client, centrifuge.SubRefreshEvent, configtypes.ChannelOptions, PerCallData) (centrifuge.SubRefreshReply, SubRefreshExtra, error)

// Handle refresh.
func (h *SubRefreshHandler) Handle(node *centrifuge.Node) SubRefreshHandlerFunc {
func (h *SubRefreshHandler) Handle() SubRefreshHandlerFunc {
return func(client Client, e centrifuge.SubRefreshEvent, chOpts configtypes.ChannelOptions, pcd PerCallData) (centrifuge.SubRefreshReply, SubRefreshExtra, error) {
started := time.Now()

Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/subscribe_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type SubscribeExtra struct {
type SubscribeHandlerFunc func(Client, centrifuge.SubscribeEvent, configtypes.ChannelOptions, PerCallData) (centrifuge.SubscribeReply, SubscribeExtra, error)

// Handle Subscribe.
func (h *SubscribeHandler) Handle(node *centrifuge.Node) SubscribeHandlerFunc {
func (h *SubscribeHandler) Handle() SubscribeHandlerFunc {
return func(client Client, e centrifuge.SubscribeEvent, chOpts configtypes.ChannelOptions, pcd PerCallData) (centrifuge.SubscribeReply, SubscribeExtra, error) {
started := time.Now()

Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/subscribe_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type subscribeHandleTestCase struct {
}

func (c subscribeHandleTestCase) invokeHandle() (reply centrifuge.SubscribeReply, err error) {
subscribeHandler := c.subscribeProxyHandler.Handle(c.node)
subscribeHandler := c.subscribeProxyHandler.Handle()
reply, _, err = subscribeHandler(c.client, centrifuge.SubscribeEvent{}, c.channelOpts, PerCallData{})

return reply, err
Expand Down
2 changes: 1 addition & 1 deletion internal/proxy/subscribe_stream_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type SubscribeStreamHandlerFunc func(
) (centrifuge.SubscribeReply, StreamPublishFunc, func(), error)

// Handle ...
func (h *SubscribeStreamHandler) Handle(node *centrifuge.Node) SubscribeStreamHandlerFunc {
func (h *SubscribeStreamHandler) Handle() SubscribeStreamHandlerFunc {
return func(
client Client, bidi bool, e centrifuge.SubscribeEvent,
chOpts configtypes.ChannelOptions, pcd PerCallData,
Expand Down
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ import (
//go:generate go run internal/gen/api/main.go
func main() {
root := app.Centrifugo()
root.AddCommand( // Add helper CLI. See `centrifugo -h` and https://centrifugal.dev/docs/server/console_commands.
cli.Version(), cli.CheckConfig(), cli.GenConfig(), cli.GenToken(), cli.GenSubToken(),
cli.CheckToken(), cli.CheckSubToken(), cli.DefaultConfig(), cli.DefaultEnv(), cli.Serve(),
// Register helper CLI.
// See `centrifugo -h` and https://centrifugal.dev/docs/server/console_commands.
root.AddCommand(
cli.Version(), cli.CheckConfig(), cli.GenConfig(), cli.GenToken(),
cli.GenSubToken(), cli.CheckToken(), cli.CheckSubToken(), cli.DefaultConfig(),
cli.DefaultEnv(), cli.Serve(),
)
_ = root.Execute()
}

0 comments on commit bc02113

Please sign in to comment.