• Felix Lange's avatar
    p2p/dnsdisc: fix hot-spin when all trees are empty (#22313) · d36276d8
    Felix Lange authored
    In the random sync algorithm used by the DNS node iterator, we first pick a random
    tree and then perform one sync action on that tree. This happens in a loop until any
    node is found. If no trees contain any nodes, the iterator will enter a hot loop spinning
    at 100% CPU.
    
    The fix is complicated. The iterator now checks if a meaningful sync action can
    be performed on any tree. If there is nothing to do, it waits for the next root record
    recheck time to arrive and then tries again.
    
    Fixes #22306
    d36276d8
sync.go 8.53 KB