Skip to content

Conversation

@revunix
Copy link

@revunix revunix commented Sep 10, 2025

Description

This pull request addresses a critical bug where the application would crash when a streamer no longer exists. Previously, when a streamer's account was deleted or banned, the StreamerDoesNotExistException was not properly handled, causing the entire application to terminate unexpectedly.

The fix implements proper exception handling in the run method of TwitchChannelPointsMiner.py at two critical points:

  1. During initial streamer data loading
  2. During the periodic context refresh (every 30 minutes)

When a StreamerDoesNotExistException is caught, the application now logs an informative message and removes the non-existent streamer from the list, allowing the application to continue running with the remaining streamers.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality not to work as expected)

How Has This Been Tested?

The fix has been tested by simulating the scenario where a streamer no longer exists. This was done by:

  1. Adding a non-existent streamer to the streamers list
  2. Running the application and verifying that it no longer crashes
  3. Checking the logs to confirm that the appropriate message is logged
  4. Verifying that the application continues to run with the remaining streamers

Test configuration:

  • Python 3.9
  • Twitch Channel Points Miner v2
  • macOS

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (README.md)
  • My changes generate no new warnings
  • Any dependent changes have been updated in requirements.txt

Copilot AI review requested due to automatic review settings September 10, 2025 11:39
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 a critical bug where the application would crash when a streamer's account was deleted or banned by implementing proper exception handling for StreamerDoesNotExistException.

  • Adds try-catch blocks around streamer data loading operations
  • Implements safe list iteration using slice copying to avoid modification-during-iteration issues
  • Logs informative messages and removes non-existent streamers instead of crashing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

# 2. Check if streamers are online
# 3. DEACTIVATED: Check if the user is a moderator. (was used before the 5th of April 2021 to deactivate predictions)
for streamer in self.streamers:
for streamer in self.streamers[:]: # Create a copy of the list to safely remove items during iteration
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

Creating a shallow copy of the entire streamers list on every iteration is inefficient. Consider iterating backwards through the list using for i in range(len(self.streamers) - 1, -1, -1): and accessing self.streamers[i], then removing by index to avoid the copy overhead.

Copilot uses AI. Check for mistakes.
self.twitch.load_channel_points_context(
self.streamers[index]
)
for streamer in self.streamers[:]: # Create a copy of the list to safely remove items during iteration
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

Creating a shallow copy of the entire streamers list on every 30-minute refresh is inefficient. Consider iterating backwards through the list using for i in range(len(self.streamers) - 1, -1, -1): and accessing self.streamers[i], then removing by index to avoid the copy overhead.

Copilot uses AI. Check for mistakes.
@revunix revunix mentioned this pull request Sep 10, 2025
@johhta johhta mentioned this pull request Sep 20, 2025
@johhta johhta mentioned this pull request Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants