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

Merge RSS and token sync #91

Merged
merged 5 commits into from
Feb 13, 2024
Merged

Merge RSS and token sync #91

merged 5 commits into from
Feb 13, 2024

Conversation

nylonee
Copy link
Owner

@nylonee nylonee commented Feb 13, 2024

Simplification of backend

Note: There should be no noticeable difference to the user

Summary by CodeRabbit

  • New Features
    • Enhanced the watchlist synchronization process to include additional watchlists on the first run.
  • Refactor
    • Improved token synchronization logic to be more efficient during the initial setup.
  • Tests
    • Updated tests to accommodate changes in the watchlist synchronization logic.

Copy link

coderabbitai bot commented Feb 13, 2024

Walkthrough

The recent updates primarily focus on enhancing the synchronization mechanism of Plex tokens and the way watchlists are fetched and processed. A notable change includes the introduction of a firstRun boolean parameter in the run function of PlexTokenSync, which alters the watchlist fetching logic based on the initial or subsequent runs. Additionally, there's a simplification in the import statements and a methodical adjustment in server logic to accommodate the new synchronization approach, alongside minor test adjustments for compatibility with the updated configurations.

Changes

File Path Change Summary
.../PlexTokenSync.scala Added firstRun: Boolean parameter to run function for differentiated watchlist fetching.
Server.scala Updated import to catsSyntaxTuple3Parallel and modified plexTokenSync to include firstRun logic.
.../PlexTokenSyncSpec.scala Adjusted tests to pass firstRun parameter; updated plexWatchlistUrls in configuration.

🐇✨
In the realm of code, where changes abound,
A rabbit hopped in, leaving footprints profound.
With a flick and a hop, it weaved through the script,
Enhancing the sync, so no token was skipped.
"To the future," it whispered, with a twinkle in its eye,
"May our watchlists always sync, under the digital sky."
🌌🚀

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 9c9c423 and ff445d7.
Files selected for processing (4)
  • src/main/scala/PlexTokenDeleteSync.scala (1 hunks)
  • src/main/scala/PlexTokenSync.scala (1 hunks)
  • src/main/scala/Server.scala (3 hunks)
  • src/test/scala/PlexTokenSyncSpec.scala (2 hunks)
Additional comments: 5
src/main/scala/Server.scala (2)
  • 3-3: The change from catsSyntaxTuple4Parallel to catsSyntaxTuple3Parallel aligns with the refactoring of the tuple in the run method to a 3-element tuple. This change is correct and necessary for the code to compile.
  • 42-47: Adding a firstRun parameter to plexTokenSync and introducing recursive logic to handle subsequent runs is a significant change. Ensure that the recursive call with firstRun = false is intentional and correctly implements the desired behavior for token synchronization. This approach effectively uses tail recursion to periodically sync tokens, adjusting the behavior based on whether it's the first run.
src/main/scala/PlexTokenSync.scala (1)
  • 16-33: The addition of the firstRun parameter to the run function and the conditional logic for fetching the self watchlist and others' watchlists based on this parameter are significant changes. This approach allows for differentiated behavior on the first run versus subsequent runs, which aligns with the PR's objective to optimize the synchronization process. Ensure that the rest of the system correctly handles this new parameter and that the intended behavior is thoroughly tested.
src/test/scala/PlexTokenSyncSpec.scala (2)
  • 28-28: The test has been updated to include the firstRun = true parameter when calling PlexTokenSync.run. This change correctly adapts the test to the new method signature and aims to test the behavior on the first run. Ensure that additional tests cover the scenario where firstRun = false to fully validate the new logic introduced in PlexTokenSync.
  • 54-54: Initializing plexWatchlistUrls with an empty Set in PlexConfiguration within the test setup is a straightforward change that reflects adjustments in how watchlists are managed or initialized during testing. This change seems to align with the modifications in the main codebase, ensuring that tests remain relevant and accurate.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ff445d7 and 8558a06.
Files selected for processing (1)
  • src/main/scala/PlexTokenSync.scala (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/scala/PlexTokenSync.scala

@nylonee
Copy link
Owner Author

nylonee commented Feb 13, 2024

This also closes #90

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8558a06 and a3ebf76.
Files selected for processing (1)
  • docker/entrypoint.sh (1 hunks)
Additional comments: 4
docker/entrypoint.sh (4)
  • 2-2: Initialization of CMD array is correct and follows best practices for defining arrays in Bash.
  • 4-4: Initialization of JAVA_OPTS array is correct and follows best practices for defining arrays in Bash.
  • 7-83: Appending values to CMD array within conditional blocks is correctly implemented using array syntax. Each condition checks for the presence of an environment variable and appends a corresponding option to the CMD array if the variable is set. This approach is both efficient and maintainable.
  • 86-86: The execution command correctly uses array expansion for both CMD and JAVA_OPTS arrays. This ensures that all elements in the arrays are correctly passed as separate arguments to the exec command, adhering to best practices in Bash scripting.

@nylonee nylonee merged commit 69b2643 into main Feb 13, 2024
2 checks passed
@nylonee nylonee deleted the remove-watchlist-sync branch February 13, 2024 17:16
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.

1 participant