aboutsummaryrefslogtreecommitdiff
path: root/syncapi/consumers
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-07-07 16:29:25 +0200
committerGitHub <noreply@github.com>2022-07-07 16:29:25 +0200
commitf76f28e6db85df145d54f4dab86be721ef641a83 (patch)
treee2e1d677438dc7d5d5c2a1bf5dded620e4c10a2d /syncapi/consumers
parentf3e8a9a4cbd63e0bd724bbef4172b810c8040fa6 (diff)
Fix issue `uint64 values with high bit are not supported` in presence (#2562)
* Fix issue #2528 * Use gomatrixserverlib.Timestamp * Use ParseUint instead of ParseInt
Diffstat (limited to 'syncapi/consumers')
-rw-r--r--syncapi/consumers/presence.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/syncapi/consumers/presence.go b/syncapi/consumers/presence.go
index 0217e195..db7d67fa 100644
--- a/syncapi/consumers/presence.go
+++ b/syncapi/consumers/presence.go
@@ -144,7 +144,7 @@ func (s *PresenceConsumer) onMessage(ctx context.Context, msg *nats.Msg) bool {
return true
}
- ts, err := strconv.Atoi(timestamp)
+ ts, err := strconv.ParseUint(timestamp, 10, 64)
if err != nil {
return true
}
@@ -157,12 +157,12 @@ func (s *PresenceConsumer) onMessage(ctx context.Context, msg *nats.Msg) bool {
// already checked, so no need to check error
p, _ := types.PresenceFromString(presence)
- s.EmitPresence(ctx, userID, p, statusMsg, ts, fromSync)
+ s.EmitPresence(ctx, userID, p, statusMsg, gomatrixserverlib.Timestamp(ts), fromSync)
return true
}
-func (s *PresenceConsumer) EmitPresence(ctx context.Context, userID string, presence types.Presence, statusMsg *string, ts int, fromSync bool) {
- pos, err := s.db.UpdatePresence(ctx, userID, presence, statusMsg, gomatrixserverlib.Timestamp(ts), fromSync)
+func (s *PresenceConsumer) EmitPresence(ctx context.Context, userID string, presence types.Presence, statusMsg *string, ts gomatrixserverlib.Timestamp, fromSync bool) {
+ pos, err := s.db.UpdatePresence(ctx, userID, presence, statusMsg, ts, fromSync)
if err != nil {
logrus.WithError(err).WithField("user", userID).WithField("presence", presence).Warn("failed to updated presence for user")
return