Fix: Cleanup twitch_token.json when disconnecting Twitch platform#212
Open
Nebhay wants to merge 4 commits intospacedriveapp:mainfrom
Open
Fix: Cleanup twitch_token.json when disconnecting Twitch platform#212Nebhay wants to merge 4 commits intospacedriveapp:mainfrom
Nebhay wants to merge 4 commits intospacedriveapp:mainfrom
Conversation
Previously, disconnecting Twitch would remove credentials from config.toml and shut down the adapter, but the token file at instance_dir/twitch_token.json was left behind. This adds cleanup of the token file during disconnect.
Walkthroughdisconnect_platform now includes Twitch-specific cleanup: when Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: tembo[bot] <208362400+tembo[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/api/messaging.rs`:
- Around line 249-252: Run rustfmt (cargo fmt --all) to fix the formatting
around the new match block; specifically reformat the match on
tokio::fs::remove_file(&token_path).await so the arms align and trailing
commas/parentheses are placed per rustfmt (ensure the Err arms and the final
closing paren are formatted like the other tracing! calls). You can also
manually adjust the spacing/line breaks in the match arms (the Ok/Err arms with
tracing::info! and tracing::warn!) to match rustfmt style, then re-run cargo fmt
to confirm the change.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change will prevent stale/invalid token issue if the user plans to reconnect twitch affter disconnecting
Previously, disconnecting Twitch would remove credentials from config.toml and shut down the adapter, but the token file at instance_dir/twitch_token.json was left behind. This adds cleanup of the token file during disconnect.
Note
Adds explicit cleanup of
twitch_token.jsonfile when the Twitch platform is disconnected. The change modifiesdisconnect_platform()insrc/api/messaging.rsto remove the token file after adapter shutdown, preventing stale tokens from persisting on reconnection. Includes error handling with appropriate logging for both successful deletion and potential failures.Written by Tembo for commit 72c80ab.