File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,19 @@ func (s *WeightedEra) GetNode(posit int) *WeightedNode {
50
50
}
51
51
52
52
func (s * WeightedEra ) NormalizeAndPopulateMap () {
53
- total := uint32 (0 )
54
- scalar := uint32 (1 )
53
+ total := float32 (0 )
54
+ scalar := float32 (1 )
55
55
for _ , n := range s .nodes {
56
56
wn := n .(* WeightedNode )
57
- total += wn .weight
57
+ total += float32 ( wn .weight )
58
58
}
59
59
60
60
if total == 0 {
61
- slog .Logf (logger .Levels .Error , "Total Node Wieght 0" )
61
+ slog .Logf (logger .Levels .Error , "Total Node Weight 0" )
62
62
return
63
63
}
64
64
65
+ slog .Logf (logger .Levels .Debug , "Total Node Weight %f" , total )
65
66
if total < MAX_WEIGHT {
66
67
// Scale weights up
67
68
scalar = MAX_WEIGHT / total
@@ -71,7 +72,7 @@ func (s *WeightedEra) NormalizeAndPopulateMap() {
71
72
lastPosit := 0
72
73
for _ , n := range s .nodes {
73
74
wn := n .(* WeightedNode )
74
- wn .weight = (( wn .weight * scalar ) / total ) * MAX_WEIGHT
75
+ wn .weight = uint32 ((( float32 ( wn .weight ) * scalar ) / total ) * MAX_WEIGHT )
75
76
slog .Logf (logger .Levels .Debug , "New Weight %d" , wn .weight )
76
77
for i := lastPosit ; uint32 (i ) < wn .weight && i < MAX_WEIGHT ; i ++ {
77
78
s .nodeMap [i ] = wn
Original file line number Diff line number Diff line change @@ -200,7 +200,8 @@ func (src *Client) connect() error {
200
200
}
201
201
sendData (sndChData , bytes , seq )
202
202
writesNotCompleted += 1
203
- slog .Gm .Event (& opName ) // These are bactched
203
+ slog .Gm .Event (& opName ) // These are batched
204
+ //slog.Logf(logger.Levels.Debug, "Sent batch -- length %d seq %d", len(bytes), seq)
204
205
}
205
206
case cnt := <- writeNotifier .NotificationChannel ():
206
207
writesNotCompleted -= cnt
You can’t perform that action at this time.
0 commit comments