bugfix: priority must be checked atomically
bugfix: priority must be checked atomically

a node's priority may be changed in between the two checks,
which with the previous code could cause:
* a node not be taken into account at all
* a list of nodes for a given prio to be replaced by a single
  node with the same prio

raintank/metrictank,raintank/raintank-metric,replay/metrictank,replay/metrictank,raintank/raintank-metric,raintank/metrictank,raintank/raintank-metric,replay/metrictank,raintank/metrictank,replay/metrictank,raintank/metrictank