Skip to content

Commit 05e318c

Browse files
authored
clean un-needed method getrelays (#57)
Signed-off-by: Ashraf Fouda <ashraf.m.fouda@gmail.com>
1 parent e991017 commit 05e318c

3 files changed

Lines changed: 9 additions & 20 deletions

File tree

pkg/environment/environment.go

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type Environment struct {
6868
// IMPORTANT NOTICE:
6969
// SINCE RELAYS FOR A NODE IS STORED ON THE CHAIN IN A LIMITED SPACE
7070
// PLEASE MAKE SURE THAT ANY ENV HAS NO MORE THAN FOUR RELAYS CONFIGURED
71-
relaysURLs []string
71+
RelaysURLs []string
7272
ActivationURL []string
7373
GraphQL []string
7474
GeoipURLs []string
@@ -134,7 +134,7 @@ var (
134134
"wss://tfchain.dev.grid.tf/",
135135
"wss://tfchain.02.dev.grid.tf",
136136
},
137-
relaysURLs: []string{
137+
RelaysURLs: []string{
138138
"wss://relay.dev.grid.tf",
139139
},
140140
ActivationURL: []string{
@@ -161,7 +161,7 @@ var (
161161
"wss://tfchain.test.grid.tf/",
162162
"wss://tfchain.02.test.grid.tf",
163163
},
164-
relaysURLs: []string{
164+
RelaysURLs: []string{
165165
"wss://relay.test.grid.tf",
166166
},
167167
ActivationURL: []string{
@@ -188,7 +188,7 @@ var (
188188
"wss://tfchain.qa.grid.tf/",
189189
"wss://tfchain.02.qa.grid.tf/",
190190
},
191-
relaysURLs: []string{
191+
RelaysURLs: []string{
192192
"wss://relay.qa.grid.tf",
193193
},
194194
ActivationURL: []string{
@@ -218,7 +218,7 @@ var (
218218
"wss://03.tfchain.grid.tf/",
219219
"wss://04.tfchain.grid.tf/",
220220
},
221-
relaysURLs: []string{
221+
RelaysURLs: []string{
222222
"wss://relay.grid.tf",
223223
},
224224
ActivationURL: []string{
@@ -266,18 +266,6 @@ func Get() (Environment, error) {
266266
return env, nil
267267
}
268268

269-
func GetRelaysURLs() []string {
270-
config, err := GetConfig()
271-
if err == nil && len(config.RelaysURLs) > 0 {
272-
log.Debug().Msg("using relays urls from zos-config")
273-
return config.RelaysURLs
274-
}
275-
276-
log.Debug().Msg("using relays urls from environment")
277-
env := MustGet()
278-
return env.relaysURLs
279-
}
280-
281269
// GetSubstrate gets a client to subsrate blockchain
282270
func GetSubstrate() (substrate.Manager, error) {
283271
env, err := Get()
@@ -356,9 +344,9 @@ func getEnvironmentFromParams(params kernel.Params) (Environment, error) {
356344
}
357345

358346
if relay, ok := params.Get("relay"); ok && len(relay) > 0 {
359-
env.relaysURLs = relay
347+
env.RelaysURLs = relay
360348
} else if relay := config.RelaysURLs; len(relay) > 0 {
361-
env.relaysURLs = relay
349+
env.RelaysURLs = relay
362350
}
363351

364352
if activation, ok := params.Get("activation"); ok && len(activation) > 0 {

pkg/events/redis.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func NewRedisStream(sub substrate.Manager, address string, farm pkg.FarmID, node
5353
}
5454

5555
func (r *RedisStream) UpdateSubstrateManager(sub substrate.Manager) {
56+
log.Info().Msg("updating substrate manager in RedisStream")
5657
r.sub = sub
5758
r.processor.update <- sub
5859
}

pkg/perf/healthcheck/network.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func networkCheck(ctx context.Context) []error {
3030
services := map[string][]string{
3131
"substrate": env.SubstrateURL,
3232
"activation": env.ActivationURL,
33-
"relay": environment.GetRelaysURLs(),
33+
"relay": env.RelaysURLs,
3434
"graphql": env.GraphQL,
3535
"hub": {env.FlistURL},
3636
"kyc": {env.KycURL},

0 commit comments

Comments
 (0)