Skip to content

Commit 7c898ff

Browse files
authored
fix: exclude blocked users from ghost monitor (#299)
1 parent 72b8217 commit 7c898ff

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/flows/monitors/ghost_users.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
@ohld complained.
77
88
Definition: a ghost is a `user` row created N seconds ago with no
9-
`user_meme_reaction` row. Two severities, both filtered by
9+
`user_meme_reaction` row, excluding users who have blocked the bot.
10+
Two severities, both filtered by
1011
`user_tg.deep_link` to exclude blocked acquisition channels (where
1112
silent drop is by design):
1213
@@ -71,6 +72,7 @@ def _ghost_count_sql() -> str:
7172
WHERE u.created_at BETWEEN NOW() - INTERVAL '25 minutes'
7273
AND NOW() - INTERVAL '60 seconds'
7374
AND u.type NOT IN ('blocked_bot', 'banned', 'waitlist')
75+
AND u.blocked_bot_at IS NULL
7476
AND NOT EXISTS (
7577
SELECT 1 FROM user_meme_reaction r WHERE r.user_id = u.id
7678
)

0 commit comments

Comments
 (0)