From f344bd263352137d5397c9f017c82c3e1dad1e54 Mon Sep 17 00:00:00 2001 From: Nimrod Gilboa Markevich <59927337+nimrod-up9@users.noreply.github.com> Date: Thu, 7 Apr 2022 10:46:30 +0300 Subject: [PATCH] Make minor changes to OasGenerator (#977) * Added log message * Remove Reset function from OasGenerator interface, use Stop+Start instead * SetEntriesQuery returns a bool stating whether the query changed --- agent/pkg/oas/oas_generator.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/agent/pkg/oas/oas_generator.go b/agent/pkg/oas/oas_generator.go index 33922e271..562eb8355 100644 --- a/agent/pkg/oas/oas_generator.go +++ b/agent/pkg/oas/oas_generator.go @@ -22,9 +22,8 @@ type OasGenerator interface { Start() Stop() IsStarted() bool - Reset() GetServiceSpecs() *sync.Map - SetEntriesQuery(query string) + SetEntriesQuery(query string) bool } type defaultOasGenerator struct { @@ -61,7 +60,7 @@ func (g *defaultOasGenerator) Stop() { return } g.cancel() - g.Reset() + g.reset() g.started = false } @@ -168,7 +167,7 @@ func (g *defaultOasGenerator) getGen(dest string, urlStr string) *SpecGen { return gen } -func (g *defaultOasGenerator) Reset() { +func (g *defaultOasGenerator) reset() { g.serviceSpecs = &sync.Map{} } @@ -176,8 +175,10 @@ func (g *defaultOasGenerator) GetServiceSpecs() *sync.Map { return g.serviceSpecs } -func (g *defaultOasGenerator) SetEntriesQuery(query string) { +func (g *defaultOasGenerator) SetEntriesQuery(query string) bool { + changed := g.entriesQuery != query g.entriesQuery = query + return changed } func NewDefaultOasGenerator(conn *basenine.Connection) *defaultOasGenerator {