Skip to content

Commit

Permalink
routing: refactor update id logging
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 <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Jun 18, 2024
1 parent 355f835 commit 4f2467f
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 4f2467f

Please sign in to comment.