| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Test.MLS.Notifications
Synopsis
- notificationAnchor :: (HasCallStack, MakesValue user) => user -> App (Maybe String)
- testWelcomeNotification :: HasCallStack => App ()
- testNotificationPagination :: HasCallStack => App ()
- testNotificationPaginationOversizeSince :: HasCallStack => App ()
Documentation
notificationAnchor :: (HasCallStack, MakesValue user) => user -> App (Maybe String) Source #
Return the id of the user's newest notification, if any.
Useful as a pagination anchor (since): instead of relying on a short
notificationTTL to expire pre-existing notifications (e.g. the welcome
notification) before querying, we page from the newest existing one.
The welcome notification is pushed asynchronously on user creation, so it may
not have landed yet when we first look. We therefore poll until the set of
pre-existing notifications stabilizes (two consecutive reads agree) before
anchoring on the newest id. This restores the "wait for the welcome
notification" duty of the old fixed sleep without the TTL-expiry race: the
previous approach set a 2s TTL and slept for 2.1s, racing the anchor to
expiry before the final since query (gundeck returns 404 by design when
the since cursor is gone).
testWelcomeNotification :: HasCallStack => App () Source #
testNotificationPagination :: HasCallStack => App () Source #