Skip to content

Support enable/disable Favicons & use concurrency to speed up loading #3641

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

Merged
merged 17 commits into from
Jun 5, 2025

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Jun 4, 2025

Change

Support Enable / Disable Favorite Icons

Since favorite icon loading may consume much time (#3635), we should provide enable / disable button for them.

Resolve #3633, #3635.

  • Enable Load favorite icons. Favorite icons are loaded during startup & reload. %AppData\Roaming\FlowLauncher\Cache\Plugins\Flow.Launcher.Plugin.BrowserBookmark\FaviconCache folder contains all favorite icons.
  • Disable Load favorite icons. Favorite icons will not be loaded during startup & reload. %AppData\Roaming\FlowLauncher\Cache\Plugins\Flow.Launcher.Plugin.BrowserBookmark\FaviconCache folder contains nothing.

Use Concurrent Way to Load Favorite Icons

Since favorite icon loading may consume much time (#3635), we need to use concurrent method to load them.

Original:

00:23:35.0453+08:00 - INFO  - ChromiumBookmarkLoader.LoadBookmarks - Load 218 favorite icons cost <693ms>
00:23:35.3935+08:00 - INFO  - FirefoxBookmarkLoaderBase.GetBookmarksFromPath - Load 262 favorite icons cost <294ms>
00:23:39.5654+08:00 - INFO  - ChromiumBookmarkLoader.LoadBookmarks - Load 391 favorite icons cost <4145ms>

After:

01:09:45.0234+08:00 - INFO  - ChromiumBookmarkLoader.LoadBookmarks - Load 218 favorite icons cost <607ms>
01:09:45.2561+08:00 - INFO  - FirefoxBookmarkLoaderBase.GetBookmarksFromPath - Load 262 favorite icons cost <197ms>
01:09:47.2034+08:00 - INFO  - ChromiumBookmarkLoader.LoadBookmarks - Load 391 favorite icons cost <1893ms>

Copy link

gitstream-cm bot commented Jun 4, 2025

🥷 Code experts: onesounds, Yusyuriv

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970, onesounds have most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 11 additions & 1 deletions
APR 81 additions & 92 deletions
MAR 17 additions & 7 deletions 183 additions & 18 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 34%
onesounds: 26%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR 55 additions & 60 deletions
MAR 32 additions & 12 deletions 407 additions & 261 deletions
FEB
JAN

Knowledge based on git-blame:
onesounds: 48%
Jack251970: 20%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
onesounds: 40%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 3 additions & 2 deletions
APR 17 additions & 17 deletions
MAR 17 additions & 18 deletions 16 additions & 2 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 12%
onesounds: 1%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR
MAR 3 additions & 3 deletions
FEB 78 additions & 68 deletions
JAN

Knowledge based on git-blame:
Jack251970: 82%
onesounds: 12%

To learn more about /:\ gitStream - Visit our Docs

This comment has been minimized.

Copy link

gitstream-cm bot commented Jun 4, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@Jack251970 Jack251970 added the enhancement New feature or request label Jun 4, 2025
@Jack251970 Jack251970 added this to the 1.20.1 milestone Jun 4, 2025
@Jack251970 Jack251970 requested review from onesounds and Copilot June 4, 2025 15:40
Copilot

This comment was marked as outdated.

@Jack251970 Jack251970 linked an issue Jun 4, 2025 that may be closed by this pull request
2 tasks
Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

📝 Walkthrough

Walkthrough

This change introduces a new setting to enable or disable the loading of favicons for browser bookmarks in the plugin. Conditional logic is added to only load favicons if the setting is enabled. UI elements and localization for the new option are included, and error handling around file monitoring and cleanup is improved.

Changes

Files/Paths Change Summary
.../ChromiumBookmarkLoader.cs
.../FirefoxBookmarkLoader.cs
Added conditional favicon loading based on new setting; improved error handling, concurrency, and resource cleanup.
.../Models/Settings.cs Added EnableFavicons boolean property to Settings class.
.../Views/SettingsControl.xaml Added a CheckBox bound to EnableFavicons setting in the settings UI.
.../Languages/en.xaml Added a new localized string for the "Load favicons" setting.
.../Main.cs Changed _settings field to internal static and reordered static field declarations.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SettingsUI
    participant Settings
    participant BookmarkLoader

    User->>SettingsUI: Toggles "Load favicons" checkbox
    SettingsUI->>Settings: Updates EnableFavicons property
    BookmarkLoader->>Settings: Checks EnableFavicons
    alt EnableFavicons is true
        BookmarkLoader->>BookmarkLoader: Load favicons for bookmarks
    else EnableFavicons is false
        BookmarkLoader->>BookmarkLoader: Skip favicon loading
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Add option to disable favicon as result icon (#3633)
Make favicon loading conditional and expose setting in UI (#3633)
Add localization for new setting (#3633)

Assessment against linked issues: Out-of-scope changes

No out-of-scope changes found.

Possibly related PRs

Suggested reviewers

  • onesounds

Poem

A bunny hopped through lines of code,
To bring you icons, on or off, as owed.
Now bookmarks shine, or stars return—
Just flip a switch, for what you yearn!
With settings clear and choices bright,
Your bookmarks now look just right.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

This comment has been minimized.

Copy link
Contributor

@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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (2)

44-53: Consider consistency with Chromium loader error handling.

The early return on file monitoring registration failure is more aggressive than the Chromium loader, which uses continue to skip problematic profiles. Consider whether users should still get bookmarks even if file monitoring fails.

For consistency, consider this approach:

-            return bookmarks;
+            // Continue loading bookmarks even if file monitoring fails
+            // Log the issue but don't prevent bookmark loading

107-110: Good defensive programming, but consider consistency.

The file existence check before deletion is defensive programming, though File.Delete() doesn't throw if the file doesn't exist. Note that the Chromium loader doesn't have this check - consider standardizing the approach across both loaders.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a761ec8 and 72bd4c2.

📒 Files selected for processing (2)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (3 hunks)
🧰 Additional context used
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 60-60:
Favicons is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

[warning] 89-89:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 81-81:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 60-60: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 130-130: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 177-177: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

[warning] 25-25: Spell check warning: moz is not a recognized word. (unrecognized-spelling)


[warning] 26-26: Spell check warning: moz is not a recognized word. (unrecognized-spelling)


[warning] 27-27: Spell check warning: moz is not a recognized word. (unrecognized-spelling)


[warning] 28-28: Spell check warning: moz is not a recognized word. (unrecognized-spelling)


[warning] 81-81: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 89-89: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 120-120: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 122-122: Spell check warning: tempfavicons is not a recognized word. (unrecognized-spelling)


[warning] 137-137: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (14)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (6)

46-46: Good error handling improvement.

The continue statement ensures that if bookmark file monitoring registration fails for one profile, the processing continues with the remaining profiles instead of completely failing. This is appropriate resilient behavior.


53-63: Well-implemented conditional favicon loading.

The conditional loading based on EnableFavoriteIcons setting properly addresses the performance concern mentioned in the PR objectives. The performance logging with stopwatch will help users understand the time impact of enabling favicons.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 60-60:
Favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 60-60: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


46-46: Good defensive programming improvement.

Adding continue to skip the problematic profile when file monitoring registration fails is a sensible approach that improves error resilience.


55-57: Efficient optimization of file system operations.

Moving the favicon database path construction and file existence check inside the conditional block prevents unnecessary file system operations when favicons are disabled.


58-61: Excellent addition of performance monitoring.

The stopwatch logging provides valuable metrics for understanding the performance impact of favicon loading, supporting the optimization goals of this feature.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 60-60:
Favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 60-60: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


53-63:

❓ Verification inconclusive

Well-implemented conditional favicon loading.

The conditional loading based on EnableFavoriteIcons setting properly implements the performance optimization feature. The stopwatch logging provides valuable performance insights.

Consider verifying thread safety of Main._settings access if this code runs in multi-threaded scenarios:


🏁 Script executed:

#!/bin/bash
# Search for concurrent access patterns to Main._settings
rg -A 3 -B 3 "Main\._settings" --type cs

Length of output: 10526


Approve conditional favicon loading with performance logging.

The added EnableFavoriteIcons guard cleanly implements the feature requirement and avoids unnecessary file I/O when favicons are disabled. Wrapping the load call in StopwatchLogInfo will provide valuable insights into any performance bottlenecks.

Files affected:

  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Consideration:
• If bookmark loading may execute off the UI thread, please verify that all access to Main._settings (e.g., EnableFavoriteIcons) is safe under concurrent reads/writes or otherwise synchronized.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 60-60:
Favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 60-60: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (8)

44-53: Good refactoring of error handling.

Moving the bookmark file registration outside the main try block with dedicated error handling allows for early return if registration fails, which is more efficient than proceeding with bookmark loading when monitoring setup has already failed.


62-67: Helpful clarifying comments.

The added comments improve code readability by clearly explaining the purpose of each major step in the database connection and query execution process.


82-92: Consistent implementation with Chromium loader.

The conditional favicon loading logic matches the pattern implemented in ChromiumBookmarkLoader.cs, ensuring consistent behavior across different browser bookmark loaders. The performance logging will provide valuable metrics for users.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 89-89:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 84-84: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 89-89: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


107-110: Defensive programming improvement.

Adding the file existence check before deletion prevents potential exceptions if the temporary file was already deleted or never created, making the cleanup more robust.


62-70: Good documentation improvements.

The added comments improve code readability and make the database operations clearer for future maintainers.


81-92: Consistent implementation of conditional favicon loading.

The implementation matches the Chromium loader pattern and correctly implements the Firefox-specific favicon database path logic. The stopwatch logging provides valuable performance insights.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 89-89:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 81-81:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 81-81: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 89-89: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)


94-95: Helpful explanatory comments for connection cleanup.

The comments clearly explain the necessity of explicit connection cleanup and provide a useful reference to the related issue.


81-89: Static analysis spelling warnings are false positives.

The spell check warnings for "favicons" and "moz" are false positives - these are legitimate technical terms in the context of browser bookmark management.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 89-89:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 81-81:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 81-81: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 84-84: Spell check warning: favicons is not a recognized word. (unrecognized-spelling)


[warning] 89-89: Spell check warning: Favicons is not a recognized word. (unrecognized-spelling)

@Jack251970 Jack251970 changed the title Support Enable / Disable Favorite Icons Support Enable / Disable Favorite Icons & Use Concurrent Way to Load Favorite Icons Jun 4, 2025

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Member

@jjw24 jjw24 left a comment

Choose a reason for hiding this comment

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

Actually, can you do me a favour for consistency, could you use favicons instead of favourite icons even for naming in the code please.

@Jack251970
Copy link
Member Author

Actually, can you do me a favour for consistency, could you use favicons instead of favourite icons even for naming in the code please.

Will do. I do not realize it is a word😂

Copy link
Contributor

@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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (1)

160-224: LGTM! Well-implemented concurrent processing with proper resource management.

The concurrent implementation using Parallel.ForEach with individual read-only SQLite connections is excellent for performance while avoiding locking issues. The use of ConcurrentDictionary for duplicate prevention and proper resource disposal in finally blocks shows good attention to thread safety and resource management.

Consider adding clarifying comments for the return statements to improve readability:

                    var url = bookmark.Url;
-                   if (string.IsNullOrEmpty(url)) return;
+                   // Skip bookmarks with empty URLs as they cannot be processed
+                   if (string.IsNullOrEmpty(url)) return;

                    // Extract domain from URL
-                   if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
-                       return;
+                   // Skip bookmarks with invalid URLs that cannot be parsed
+                   if (!Uri.TryCreate(url, UriKind.Absolute, out Uri uri))
+                       return;
🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 184-184:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 163-163:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 163-163: favicons is not a recognized word. (unrecognized-spelling)


[warning] 184-184: favicons is not a recognized word. (unrecognized-spelling)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76dc354 and 69dd038.

📒 Files selected for processing (2)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml
🧰 Additional context used
🧬 Code Graph Analysis (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (2)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (2)
  • Main (16-258)
  • Dispose (245-248)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (2)
  • LoadFaviconsFromDb (119-236)
  • SaveBitmapData (238-248)
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 62-62:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 54-54:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 163-163:
favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 54-54: favicons is not a recognized word. (unrecognized-spelling)


[warning] 62-62: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 132-132: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 163-163: favicons is not a recognized word. (unrecognized-spelling)


[warning] 184-184: favicons is not a recognized word. (unrecognized-spelling)

🔇 Additional comments (3)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (3)

1-2: LGTM! Necessary imports for concurrent processing.

The added using statements support the new concurrent favicon loading functionality with ConcurrentDictionary and Parallel.ForEach.

Also applies to: 6-6


48-48: LGTM! Improves robustness by continuing profile processing on failures.

The continue statement ensures that if one profile fails to register file monitoring, other profiles can still be processed successfully.


55-65: LGTM! Clean implementation of conditional favicon loading.

The conditional logic properly implements the enable/disable functionality for favicon loading, includes appropriate file existence checks, and adds performance logging for monitoring load times.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 62-62:
Favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 62-62: Favicons is not a recognized word. (unrecognized-spelling)

Copy link

github-actions bot commented Jun 5, 2025

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 22
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@Jack251970
Copy link
Member Author

@jjw24 Done!

@Jack251970 Jack251970 requested a review from jjw24 June 5, 2025 02:22
@Jack251970 Jack251970 changed the title Support Enable / Disable Favorite Icons & Use Concurrent Way to Load Favorite Icons Support Enable / Disable Favicons & Use Concurrent Way to Load Favicons Jun 5, 2025
Copy link
Contributor

@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.

Actionable comments posted: 0

♻️ Duplicate comments (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (1)

173-173: Clarify the purpose of early return statements.

Consider adding a brief comment to explain that return statements in the parallel loop skip processing bookmarks with invalid URLs, as suggested in previous reviews.

🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (1)

44-53: Consider less aggressive error handling for file monitoring registration.

The early return on file monitoring registration failure means no bookmarks will be loaded if monitoring fails. Consider whether this is too restrictive - you might want to proceed with bookmark loading even if monitoring setup fails.

Apply this diff if you want to proceed with bookmark loading despite monitoring failures:

-            return bookmarks;
+            // Continue with bookmark loading even if monitoring fails
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69dd038 and 94b8a66.

📒 Files selected for processing (5)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (7 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Languages/en.xaml
🚧 Files skipped from review as they are similar to previous changes (2)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/Settings.cs
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/SettingsControl.xaml
🧰 Additional context used
🧬 Code Graph Analysis (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (2)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (2)
  • Main (16-258)
  • Dispose (245-248)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (2)
  • LoadFaviconsFromDb (119-236)
  • SaveBitmapData (238-248)
🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

[warning] 27-27: moz is not a recognized word. (unrecognized-spelling)


[warning] 28-28: moz is not a recognized word. (unrecognized-spelling)


[warning] 29-29: moz is not a recognized word. (unrecognized-spelling)


[warning] 30-30: moz is not a recognized word. (unrecognized-spelling)


[warning] 81-81: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 122-122: tempfavicons is not a recognized word. (unrecognized-spelling)

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 54-54: favicons is not a recognized word. (unrecognized-spelling)


[warning] 57-57: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 60-60: favicons is not a recognized word. (unrecognized-spelling)


[warning] 62-62: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 132-132: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 163-163: favicons is not a recognized word. (unrecognized-spelling)


[warning] 184-184: favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 62-62:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 60-60:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 57-57:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 54-54:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 163-163:
favicons is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (13)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (7)

1-6: Imports correctly added for concurrent processing.

The addition of System.Collections.Concurrent and System.Threading.Tasks imports supports the new parallel favicon loading implementation.


47-49: Improved error handling for file monitoring registration.

The continue statement allows processing to continue with other browser profiles even if file monitoring registration fails for one profile, which is the correct behavior.


55-65: Conditional favicon loading with performance monitoring implemented correctly.

The favicon loading is now properly gated by the EnableFavicons setting and includes performance measurement via stopwatch logging. This addresses the performance concerns mentioned in the PR objectives.

🧰 Tools
🪛 GitHub Check: Check Spelling

[warning] 62-62:
Favicons is not a recognized word. (unrecognized-spelling)


[warning] 60-60:
favicons is not a recognized word. (unrecognized-spelling)


[warning] 57-57:
Favicons is not a recognized word. (unrecognized-spelling)

🪛 GitHub Actions: Check Spelling

[warning] 57-57: Favicons is not a recognized word. (unrecognized-spelling)


[warning] 60-60: favicons is not a recognized word. (unrecognized-spelling)


[warning] 62-62: Favicons is not a recognized word. (unrecognized-spelling)


160-161: Thread-safe duplicate prevention implemented correctly.

Using ConcurrentDictionary<string, bool> to track saved favicon paths prevents duplicate file writes in the concurrent processing context.


164-168: Concurrent processing with individual read-only connections.

The parallel processing implementation correctly creates a separate read-only SQLite connection for each bookmark to avoid locking issues. This is a sound approach for concurrent database access.


205-209: Duplicate favicon filtering implemented correctly.

The TryAdd method on ConcurrentDictionary ensures thread-safe duplicate prevention, only saving favicons that haven't been processed before.


217-223: Proper SQLite connection cleanup implemented.

The finally block ensures proper resource cleanup with connection pool clearing, closing, and disposal. This addresses the EF Core issue referenced in the comment.

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (6)

1-6: Imports correctly added for concurrent processing.

The concurrent processing imports align with the parallel favicon loading implementation and are consistent with the ChromiumBookmarkLoader changes.


63-63: Explicit read-only mode for database connection.

Adding explicit Mode=ReadOnly to the connection string is a good practice that makes the intent clear and potentially provides performance benefits.


81-91: Conditional favicon loading with performance monitoring implemented correctly.

The favicon loading implementation matches the ChromiumBookmarkLoader pattern with proper setting checks and performance measurement.

🧰 Tools
🪛 GitHub Actions: Check Spelling

[warning] 81-81: Favicons is not a recognized word. (unrecognized-spelling)


128-143: Comprehensive error handling for database file operations.

The nested try-catch blocks properly handle both database copy failures and cleanup failures, with appropriate logging for debugging.


147-155: Consistent concurrent processing implementation.

The parallel processing pattern with ConcurrentDictionary and individual read-only connections mirrors the ChromiumBookmarkLoader implementation, ensuring consistency across browser types.


213-219: Proper resource cleanup in concurrent context.

The finally block ensures each connection is properly cleaned up with pool clearing, closing, and disposal, which is essential in the concurrent processing context.

@Jack251970 Jack251970 enabled auto-merge June 5, 2025 02:27
@Jack251970 Jack251970 merged commit a865a3b into dev Jun 5, 2025
6 checks passed
@Jack251970 Jack251970 deleted the favorite_icons_enabled_disabled branch June 5, 2025 02:36
@jjw24 jjw24 added bug Something isn't working and removed enhancement New feature or request labels Jun 5, 2025
@jjw24 jjw24 changed the title Support Enable / Disable Favicons & Use Concurrent Way to Load Favicons Support enable/disable Favicons & use concurrency to speed up loading Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants