Skip to content

Conversation

@olivermrose
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the subscription key management in the 7TV event API client by incorporating an ID into the subscription key. This change allows for multiple subscriptions to the same event type but with different IDs, preventing collisions in the subscription HashMap.

Key changes:

  • Modified subscription keys from event to id:event format to enable multiple subscriptions per event type
  • Updated subscribe() to extract and validate the ID from the condition before creating subscriptions
  • Updated unsubscribe() to accept an ID parameter for proper subscription removal

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src-tauri/src/seventv/client.rs Updated subscription key format to include ID, modified subscribe() to extract ID from condition, updated unsubscribe() signature to accept ID parameter, and adjusted unsubscribe_all() to parse the new key format
src-tauri/src/seventv/mod.rs Updated resub_emote_set() to pass the set_id parameter to the unsubscribe() call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


for (event, condition) in subscriptions.drain() {
for (key, condition) in subscriptions.drain() {
let (_, event) = key.split_once(':').unwrap();
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The unwrap() call on split_once(':') could panic if the subscription key format is unexpected or malformed. Consider using proper error handling or a split_once(':').expect() with a descriptive message, or use pattern matching with if let Some((_, event)) = key.split_once(':') to skip malformed keys.

Copilot uses AI. Check for mistakes.
@olivermrose olivermrose merged commit c0ab994 into main Dec 19, 2025
8 checks passed
@olivermrose olivermrose deleted the fix/sub-key branch December 19, 2025 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants