Skip to content

Commit

Permalink
Fix incrementation of observations received by topic
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippMatthes committed Apr 30, 2024
1 parent 47cb878 commit 0752c51
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions observations/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func processMessage(msg mqtt.Message) {

// Increment the number of received messages.
val, _ := ObservationsReceivedByTopic.LoadOrStore(dsType.(string), uint64(1))
ptr := val.(*int64)
atomic.AddInt64(ptr, 1)
ObservationsReceivedByTopic.Store(dsType.(string), val.(uint64)+1)

var observation Observation
if err := json.Unmarshal(msg.Payload(), &observation); err != nil {
Expand Down

0 comments on commit 0752c51

Please sign in to comment.