Skip to content

Commit

Permalink
routing: refactor update id logging (#3116)
Browse files Browse the repository at this point in the history
Increment update id only on update receival instead of
each loop cycle which results in odd update id values due to second select case branch.

Follow up on #3112

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Jun 18, 2024
1 parent 355f835 commit 7da6fc6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions routing/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,14 +542,16 @@ func receiveRouteMatcher(o Options, out chan<- *routeTable, quit <-chan struct{}
rt *routeTable
outRelay chan<- *routeTable
updatesRelay <-chan []*eskip.Route
updateId int
)
updatesRelay = updates
for id := 1; ; id++ {
for {
select {
case defs := <-updatesRelay:
updateId++
start := time.Now()

o.Log.Infof("route settings received, id: %d", id)
o.Log.Infof("route settings received, id: %d", updateId)

for i := range o.PreProcessors {
defs = o.PreProcessors[i].Do(defs)
Expand Down Expand Up @@ -585,7 +587,7 @@ func receiveRouteMatcher(o Options, out chan<- *routeTable, quit <-chan struct{}
})

rt = &routeTable{
id: id,
id: updateId,
m: m,
routes: routes,
validRoutes: validRoutes,
Expand Down

0 comments on commit 7da6fc6

Please sign in to comment.