Skip to content

Commit

Permalink
Updated InstancerOption
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsxin committed May 1, 2024
1 parent 269cffb commit 7cff930
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sd/consul/instancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TagsInstancerOptions(tags []string) InstancerOption {
}
}

func NewInstancer(client Client, logger *log.Logger, service string, passingOnly bool) *Instancer {
func NewInstancer(client Client, logger *log.Logger, service string, passingOnly bool, options ...InstancerOption) *Instancer {
s := &Instancer{
cache: instance.NewCache(),
client: client,
Expand All @@ -52,6 +52,9 @@ func NewInstancer(client Client, logger *log.Logger, service string, passingOnly
} else {
s.logger.Sugar().Debugln("err", err)
}
for _, option := range options {
option(s)
}

s.cache.Update(events.Event{Instances: instances, Err: err})
go s.loop(index)
Expand Down

0 comments on commit 7cff930

Please sign in to comment.