Skip to content

Commit

Permalink
fix: Do not release mutex for printing log message
Browse files Browse the repository at this point in the history
  • Loading branch information
rewenset authored and rewenset committed Mar 12, 2021
1 parent fd54fd6 commit 82ffc0b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plugins/vpp/ifplugin/interface_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,18 @@ func (c *InterfaceStateUpdater) doUpdatesIfStateDetails() {
return
}

// we dont want to lock during potentionally long dump call
c.access.Unlock()

c.log.Debugf("updating interface states for %d interfaces", len(c.ifsForUpdate))

var ifIdxs []uint32
c.access.Lock()
if len(c.ifsForUpdate) < 1000 {
for ifIdx := range c.ifsForUpdate {
ifIdxs = append(ifIdxs, ifIdx)
}
}
// clear interfaces for update
c.ifsForUpdate = make(map[uint32]struct{})

// we dont want to lock during potentionally long dump call
c.access.Unlock()

ifaces, err := c.ifHandler.DumpInterfaceStates(ifIdxs...)
Expand Down

0 comments on commit 82ffc0b

Please sign in to comment.