Skip to content

Commit

Permalink
Merge pull request #1016 from planetary-social/fix-long-subscription-ids
Browse files Browse the repository at this point in the history
Fix issue causing 'subscription id too long' messages
  • Loading branch information
mplorentz authored Apr 9, 2024
2 parents 1712178 + 34afa9b commit 9995cf8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Nos/Models/RelaySubscription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ struct RelaySubscription: Identifiable {
) {
self.filter = filter
self.relayAddress = relayAddress
self.id = filter.id + "-" + relayAddress.absoluteString
// Compute a unique ID but predictable ID. The sha256 cuts the length down to an acceptable size.
self.id = (filter.id + "-" + relayAddress.absoluteString).data(using: .utf8)?.sha256 ?? "error"
self.subscriptionStartDate = subscriptionStartDate
self.oldestEventCreationDate = oldestEventCreationDate
self.referenceCount = referenceCount
Expand Down

0 comments on commit 9995cf8

Please sign in to comment.