Skip to content

Commit cf559ee

Browse files
committed
smp server: fix notifiers lost when compacting store log (#1347)
1 parent 4268b90 commit cf559ee

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/Simplex/FileTransfer/Server/Store.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ fileTimePrecision :: Int64
5454
fileTimePrecision = 3600 -- truncate creation time to 1 hour
5555

5656
data FileRecipient = FileRecipient RecipientId RcvPublicAuthKey
57+
deriving (Show)
5758

5859
instance StrEncoding FileRecipient where
5960
strEncode (FileRecipient rId rKey) = strEncode rId <> ":" <> strEncode rKey

src/Simplex/FileTransfer/Server/StoreLog.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ data FileStoreLogRecord
4444
| AddRecipients SenderId (NonEmpty FileRecipient)
4545
| DeleteFile SenderId
4646
| AckFile RecipientId
47+
deriving (Show)
4748

4849
instance StrEncoding FileStoreLogRecord where
4950
strEncode = \case

src/Simplex/Messaging/Notifications/Server/StoreLog.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ data NtfStoreLogRecord
5050
| CreateSubscription NtfSubRec
5151
| SubscriptionStatus NtfSubscriptionId NtfSubStatus
5252
| DeleteSubscription NtfSubscriptionId
53+
deriving (Show)
5354

5455
data NtfTknRec = NtfTknRec
5556
{ ntfTknId :: NtfTokenId,
@@ -61,6 +62,7 @@ data NtfTknRec = NtfTknRec
6162
tknRegCode :: NtfRegCode,
6263
tknCronInterval :: Word16
6364
}
65+
deriving (Show)
6466

6567
mkTknData :: NtfTknRec -> STM NtfTknData
6668
mkTknData NtfTknRec {ntfTknId, token, tknStatus = status, tknVerifyKey, tknDhKeys, tknDhSecret, tknRegCode, tknCronInterval = cronInt} = do
@@ -81,6 +83,7 @@ data NtfSubRec = NtfSubRec
8183
tokenId :: NtfTokenId,
8284
subStatus :: NtfSubStatus
8385
}
86+
deriving (Show)
8487

8588
mkSubData :: NtfSubRec -> STM NtfSubData
8689
mkSubData NtfSubRec {ntfSubId, smpQueue, notifierKey, tokenId, subStatus = status} = do

src/Simplex/Messaging/Server/StoreLog.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ data StoreLogRecord
5555
| DeleteQueue QueueId
5656
| DeleteNotifier QueueId
5757
| UpdateTime QueueId RoundedSystemTime
58+
deriving (Show)
5859

5960
data SLRTag
6061
= CreateQueue_
@@ -74,10 +75,11 @@ instance StrEncoding QueueRec where
7475
"sid=" <> strEncode senderId,
7576
"sk=" <> strEncode senderKey
7677
]
77-
<> if sndSecure then " sndSecure=" <> strEncode sndSecure else ""
78+
<> sndSecureStr
7879
<> maybe "" notifierStr notifier
7980
<> maybe "" updatedAtStr updatedAt
8081
where
82+
sndSecureStr = if sndSecure then " sndSecure=" <> strEncode sndSecure else ""
8183
notifierStr ntfCreds = " notifier=" <> strEncode ntfCreds
8284
updatedAtStr t = " updated_at=" <> strEncode t
8385

0 commit comments

Comments
 (0)