From ca0e0829b2c80ef0175a9bbae4f40247905132ce Mon Sep 17 00:00:00 2001 From: Will Andrews Date: Fri, 22 Nov 2024 14:31:08 +0000 Subject: [PATCH] order by descending order --- main.go | 2 ++ store/feed.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index bd725b9..d7c540f 100644 --- a/main.go +++ b/main.go @@ -104,4 +104,6 @@ func consumeLoop(ctx context.Context, jsServerAddr string, store *store.Store) { } return nil }, retry.Attempts(0)) // retry indefinitly until context canceled + + slog.Warn("exiting consume loop") } diff --git a/store/feed.go b/store/feed.go index 25e2f5f..8a6f07e 100644 --- a/store/feed.go +++ b/store/feed.go @@ -50,7 +50,7 @@ func (s *Store) AddFeedPost(feedPost FeedPost) error { func (s *Store) GetUsersFeed(usersDID string, cursor int64, limit int) ([]FeedPost, error) { sql := `SELECT id, replyURI, userDID, subscribedPostURI, createdAt FROM feed WHERE userDID = ? AND createdAt < ? - ORDER BY createdAt LIMIT ?;` + ORDER BY DESC createdAt LIMIT ?;` rows, err := s.db.Query(sql, usersDID, cursor, limit) if err != nil { return nil, fmt.Errorf("run query to get users feed posts: %w", err) -- 2.51.2