Skip to content

Commit

Permalink
[fix] set notificationTimeOut to 28 days, make it legible (#3714)
Browse files Browse the repository at this point in the history
  • Loading branch information
MangoIV authored Nov 15, 2023
1 parent d57d4dd commit 6d706ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/correct-notification-timeout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set notificationTimeOut to 28 days, make it legible
8 changes: 7 additions & 1 deletion services/galley/src/Galley/Cassandra/TeamNotifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import Data.List1 (List1)
import Data.Range (Range, fromRange)
import Data.Sequence (Seq, ViewL (..), ViewR (..), (<|), (><))
import Data.Sequence qualified as Seq
import Data.Time (nominalDay, nominalDiffTimeToSeconds)
import Data.UUID.V1 qualified as UUID
import Galley.Cassandra.Store
import Galley.Data.TeamNotifications
Expand Down Expand Up @@ -84,8 +85,13 @@ add tid nid (Blob . JSON.encode -> payload) =
\(?, ?, ?) \
\USING TTL ?"

-- |
--
-- >>> import Data.Time
-- >>> formatTime defaultTimeLocale "%d days, %H hours, %M minutes, %S seconds" (secondsToNominalDiffTime (fromIntegral notificationTTLSeconds))
-- "28 days, 0 hours, 0 minutes, 0 seconds"
notificationTTLSeconds :: Int32
notificationTTLSeconds = 24192200
notificationTTLSeconds = round $ nominalDiffTimeToSeconds $ 28 * nominalDay

fetch :: TeamId -> Maybe NotificationId -> Range 1 10000 Int32 -> Client ResultPage
fetch tid since (fromRange -> size) = do
Expand Down

0 comments on commit 6d706ca

Please sign in to comment.