Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue causing 'subscription id too long' messages #1016

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you spotted it. Do you mind adding a comment in the code linking to this PR? Just in case in the future we wonder the same thing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Done!

self.subscriptionStartDate = subscriptionStartDate
self.oldestEventCreationDate = oldestEventCreationDate
self.referenceCount = referenceCount
Expand Down