cleanup to satisfy linter
This commit is contained in:
1 parent
11f91b67a8
commit
0222dfd865
15 files changed
+58
-63
No files matched your search
@@ -73,8 +73,8 @@ func (s commonConfigService) HandleUpsertConfigCommand(upsertConfig cluster.Upse
|
||||
return cluster.NewResponse(config)
|
||||
}
|
||||
|
||||
func (s commonConfigService) GetCommonConfigLinks(commonConfigId string, state state.ReadonlyState) domain.CommonConfigLinks {
|
||||
configs := state.Configs().FilterByCommonConfigs([]string{commonConfigId})
|
||||
func (s commonConfigService) GetCommonConfigLinks(commonConfigID string, state state.ReadonlyState) domain.CommonConfigLinks {
|
||||
configs := state.Configs().FilterByCommonConfigs([]string{commonConfigID})
|
||||
result := make(domain.CommonConfigLinks)
|
||||
for _, c := range configs {
|
||||
module := state.Modules().GetById(c.ModuleId)
|
||||
|
||||
+2
-2
@@ -158,8 +158,8 @@ func (cs configService) HandleUpsertConfigCommand(upsertConfig cluster.UpsertCon
|
||||
|
||||
func (cs configService) BroadcastNewConfig(state state.ReadonlyState, configs ...entity.Config) {
|
||||
for _, cfg := range configs {
|
||||
moduleId := cfg.ModuleId
|
||||
module := state.Modules().GetById(moduleId)
|
||||
moduleID := cfg.ModuleId
|
||||
module := state.Modules().GetById(moduleID)
|
||||
moduleName := module.Name
|
||||
room := moduleName + ConfigWatchersRoomSuffix
|
||||
|
||||
|
||||
+19
-19
@@ -24,12 +24,12 @@ type discoveryService struct {
|
||||
lock sync.RWMutex
|
||||
}
|
||||
|
||||
func (ds *discoveryService) HandleDisconnect(connId string) {
|
||||
func (ds *discoveryService) HandleDisconnect(connID string) {
|
||||
ds.lock.Lock()
|
||||
defer ds.lock.Unlock()
|
||||
if events, ok := ds.subs[connId]; ok {
|
||||
holder.EtpServer.Rooms().LeaveByConnId(connId, events...)
|
||||
delete(ds.subs, connId)
|
||||
if events, ok := ds.subs[connID]; ok {
|
||||
holder.EtpServer.Rooms().LeaveByConnId(connID, events...)
|
||||
delete(ds.subs, connID)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,28 +76,28 @@ func (ds *discoveryService) BroadcastModuleAddresses(moduleName string, mesh sta
|
||||
}
|
||||
|
||||
func (ds *discoveryService) broadcastAddrList(room string, event string, addressList []structure.AddressConfiguration) error {
|
||||
if bytes, err := json.Marshal(addressList); err != nil {
|
||||
bytes, err := json.Marshal(addressList)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = holder.EtpServer.BroadcastToRoom(room, event, bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
err = holder.EtpServer.BroadcastToRoom(room, event, bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ds *discoveryService) sendAddrList(conn etp.Conn, event string, addressList []structure.AddressConfiguration) error {
|
||||
if bytes, err := json.Marshal(addressList); err != nil {
|
||||
bytes, err := json.Marshal(addressList)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(100*time.Millisecond), 3)
|
||||
err = backoff.Retry(func() error {
|
||||
return conn.Emit(context.Background(), event, bytes)
|
||||
}, bf)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
bf := backoff.WithMaxRetries(backoff.NewConstantBackOff(100*time.Millisecond), 3)
|
||||
err := backoff.Retry(func() error {
|
||||
return conn.Emit(context.Background(), event, bytes)
|
||||
}, bf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+8
-8
@@ -22,8 +22,8 @@ var RoutesService routesService
|
||||
|
||||
type routesService struct{}
|
||||
|
||||
func (rs *routesService) HandleDisconnect(connId string) {
|
||||
holder.EtpServer.Rooms().LeaveByConnId(connId, RoutesSubscribersRoom)
|
||||
func (rs *routesService) HandleDisconnect(connID string) {
|
||||
holder.EtpServer.Rooms().LeaveByConnId(connID, RoutesSubscribersRoom)
|
||||
}
|
||||
|
||||
func (rs *routesService) SubscribeRoutes(conn etp.Conn, mesh state.ReadonlyMesh) {
|
||||
@@ -48,13 +48,13 @@ func (rs *routesService) BroadcastRoutes(mesh state.ReadonlyMesh) {
|
||||
}
|
||||
|
||||
func (rs *routesService) broadcastRoutes(event string, routes structure.RoutingConfig) error {
|
||||
if bytes, err := json.Marshal(routes); err != nil {
|
||||
bytes, err := json.Marshal(routes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = holder.EtpServer.BroadcastToRoom(RoutesSubscribersRoom, event, bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
err = holder.EtpServer.BroadcastToRoom(RoutesSubscribersRoom, event, bytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user