From 8674dc8e62b174fd28166f10ea86d6472e669f09 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 6 Aug 2020 10:27:58 +0100 Subject: [PATCH] Remove precache in favour of just pulling by default --- router/options.go | 9 --------- router/registry/registry.go | 8 +++----- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/router/options.go b/router/options.go index f162fefd..f2ac4e91 100644 --- a/router/options.go +++ b/router/options.go @@ -24,8 +24,6 @@ type Options struct { Advertise Strategy // Context for additional options Context context.Context - // Precache the route table on router startup - Precache bool } // Id sets Router Id @@ -70,13 +68,6 @@ func Advertise(a Strategy) Option { } } -// Precache sets whether to precache the route table -func Precache(b bool) Option { - return func(o *Options) { - o.Precache = b - } -} - // DefaultOptions returns router default options func DefaultOptions() Options { return Options{ diff --git a/router/registry/registry.go b/router/registry/registry.go index e3e3728d..ac192857 100644 --- a/router/registry/registry.go +++ b/router/registry/registry.go @@ -473,11 +473,9 @@ func (r *rtr) start() error { return nil } - if r.options.Precache { - // add all local service routes into the routing table - if err := r.manageRegistryRoutes(r.options.Registry, "create"); err != nil { - return fmt.Errorf("failed adding registry routes: %s", err) - } + // add all local service routes into the routing table + if err := r.manageRegistryRoutes(r.options.Registry, "create"); err != nil { + return fmt.Errorf("failed adding registry routes: %s", err) } // add default gateway into routing table