|
@ -44,8 +44,8 @@ func CancelUpdate() { |
|
|
func CommitUpdate() error { |
|
|
func CommitUpdate() error { |
|
|
defer updateMutex.Unlock() |
|
|
defer updateMutex.Unlock() |
|
|
|
|
|
|
|
|
for nick, weight := range updateMap { |
|
|
|
|
|
_, err := collection.UpsertId(nick, bson.M{"$set": bson.M{"weight": weight}}) |
|
|
|
|
|
|
|
|
for nick, score := range updateMap { |
|
|
|
|
|
_, err := collection.UpsertId(nick, bson.M{"$set": bson.M{"score": score}}) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|