Using polling for load balance
(nextNodeIndex int, nodeList []uint64)
| 993 | |
| 994 | //Using polling for load balance |
| 995 | func getNextNodeId(nextNodeIndex int, nodeList []uint64) (int, uint64) { |
| 996 | num := len(nodeList) |
| 997 | if num == 0 { |
| 998 | return 0, 0 |
| 999 | } |
| 1000 | if nextNodeIndex >= num { |
| 1001 | nextNodeIndex = 0 |
| 1002 | } |
| 1003 | index := nextNodeIndex |
| 1004 | nextNodeIndex++ |
| 1005 | return nextNodeIndex, nodeList[index] |
| 1006 | } |