diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index 88956d4fb..df108568c 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -11,7 +11,7 @@ import ( // Location holds the result of a geoip request type Location struct { - Longitute float64 `json:"longitude"` + Longitude float64 `json:"longitude"` Latitude float64 `json:"latitude"` Continent string `json:"continent"` Country string `json:"country_name"` @@ -45,7 +45,7 @@ func Fetch() (Location, error) { func getLocation(geoIPService string) (Location, error) { l := Location{ - Longitute: 0.0, + Longitude: 0.0, Latitude: 0.0, Continent: "Unknown", Country: "Unknown", diff --git a/pkg/registrar/register.go b/pkg/registrar/register.go index 891d2ee37..f077bbcdf 100644 --- a/pkg/registrar/register.go +++ b/pkg/registrar/register.go @@ -138,7 +138,7 @@ func registerNode( } location := substrate.Location{ - Longitude: fmt.Sprint(info.Location.Longitute), + Longitude: fmt.Sprint(info.Location.Longitude), Latitude: fmt.Sprint(info.Location.Latitude), Country: info.Location.Country, City: info.Location.City, diff --git a/pkg/registrar/registrar.go b/pkg/registrar/registrar.go index 25e6756db..b8bc67b3c 100644 --- a/pkg/registrar/registrar.go +++ b/pkg/registrar/registrar.go @@ -23,7 +23,8 @@ const ( InProgress RegistrationState = "InProgress" Done RegistrationState = "Done" - monitorAccountEvery = 30 * time.Minute + monitorAccountEvery = 30 * time.Minute + updateNodeInfoInterval = 24 * time.Hour ) var ( @@ -80,6 +81,7 @@ func NewRegistrar(ctx context.Context, cl zbus.Client, env environment.Environme }, sync.RWMutex{}, } + go r.register(ctx, cl, env, info) return &r } @@ -146,6 +148,9 @@ func (r *Registrar) register(ctx context.Context, cl zbus.Client, env environmen if err := r.reActivate(ctx, cl, env); err != nil { log.Error().Err(err).Msg("failed to reactivate account") } + case <-time.After(updateNodeInfoInterval): + log.Info().Msg("update interval passed, re-register") + register() case <-addressesUpdate: log.Info().Msg("zos address has changed, re-register") register()