Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Improve query

Neeraj Guptafebe462d2b6f
diff --git a/server/pkg/repo/user.go b/server/pkg/repo/user.go
index 8b43311953..7e9fbf0090 100644
--- a/server/pkg/repo/user.go
+++ b/server/pkg/repo/user.go
@@ -178,11 +178,12 @@ func (repo *UserRepository) GetActiveUsersByLastActivityBefore(beforeTime int64,
WHERE c.owner_id = u.user_id
ORDER BY c.updation_time DESC
LIMIT 1
- ) c ON TRUE
- WHERE u.encrypted_email IS NOT NULL
- AND u.user_id > $2
- ) candidate
- WHERE candidate.last_activity <= $1
+ ) c ON TRUE
+ WHERE u.encrypted_email IS NOT NULL
+ AND u.creation_time <= $1
+ AND u.user_id > $2
+ ) candidate
+ WHERE candidate.last_activity <= $1
ORDER BY candidate.user_id
LIMIT $3`, beforeTime, afterUserID, limit)
if err != nil {