feat(social): show friend presence and require online listening
ci / api / api (push) Successful in 1m11s
ci / db / db (push) Failing after 23s
ci / mobile / mobile (Metro-бандл Android) (push) Successful in 1m29s
ci / ts / ts (packages + web) (push) Successful in 3m15s
ci / contract / contract (сгенерированный код совпадает с openapi.yaml) (push) Successful in 1m27s

This commit is contained in:
mrleo1nid committed 2026-10-23 12:52:00 +03:00
1 parent 582c0dc3d4
commit cd84ceecb2
26 files changed
+574 -400

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
package social
import (
"context"
"github.com/google/uuid"
)
// Existing authenticated social/listening polls serve as heartbeats, including
// while playback is paused or music visibility is off. Coalesce frequent polls
// to one write per account per ten seconds; abandoned clients expire in 45s.
func (s *Store) markPresent(ctx context.Context, id uuid.UUID) error {
_, e := s.pool.Exec(ctx, `UPDATE users SET social_seen_at=now()
WHERE id=$1 AND (social_seen_at IS NULL OR social_seen_at<now()-interval '10 seconds')`, id)
return e
}