Skip to content

Clean orphan files, temp fix #3902

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 1 commit into from
Aug 16, 2025

Conversation

dcog989
Copy link
Contributor

@dcog989 dcog989 commented Aug 14, 2025

Clean orphan SQLite files on start-up that are being created by BrowserBookmark plugin. This is a temporary solution to prevent users' cache accumulating very large numbers of files / MB.

Will be addressed properly with new version of plugin (complete rewrite for Flow Launcher V2).

Clean orphan SQLite files on start-up that are being created by BrowserBookmark plugin.  This is a temporary solution to prevent users' cache accumulating very large numbers of files / MB.

Will be addressed properly with new version of plugin (complete rewrite for Flow Launcher V2).
@prlabeler prlabeler bot added the bug Something isn't working label Aug 14, 2025
Copy link

gitstream-cm bot commented Aug 14, 2025

🥷 Code experts: Jack251970, Yusyuriv

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

See details

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

Activity based on git-commit:

Jack251970 onesounds
AUG
JUL 5 additions & 8 deletions
JUN 18 additions & 18 deletions
MAY 3 additions & 2 deletions
APR 17 additions & 17 deletions
MAR 17 additions & 18 deletions 16 additions & 2 deletions

Knowledge based on git-blame:
Yusyuriv: 59%
Jack251970: 18%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Copy link

gitstream-cm bot commented Aug 14, 2025

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

Copy link
Contributor

coderabbitai bot commented Aug 14, 2025

📝 Walkthrough

Walkthrough

Added a startup cleanup in BrowserBookmark plugin Init to delete orphaned SQLite cache files (.db-shm/.db-wal/.sqlite-shm/.sqlite-wal) from the favicon cache directory, wrapped in try-catch with exception logging, then proceeds to LoadBookmarksIfEnabled.

Changes

Cohort / File(s) Summary of Changes
Favicon cache cleanup on Init
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs
On Init, enumerates favicon cache directory and deletes orphaned SQLite sidecar files (.db-shm, .db-wal, .sqlite-shm, .sqlite-wal). Exceptions are caught and logged via Context.API.LogException. Continues with LoadBookmarksIfEnabled.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant BrowserBookmarkPlugin
    participant FileSystem
    participant Logger

    App->>BrowserBookmarkPlugin: Init()
    BrowserBookmarkPlugin->>FileSystem: Enumerate favicon cache dir
    alt Orphaned SQLite sidecar files found
        BrowserBookmarkPlugin->>FileSystem: Delete *.db-shm/*.db-wal/*.sqlite-shm/*.sqlite-wal
    end
    opt On exception
        BrowserBookmarkPlugin->>Logger: LogException("Failed to cleanup favicon cache", ex)
    end
    BrowserBookmarkPlugin-->>App: LoadBookmarksIfEnabled()
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Suggested reviewers

  • jjw24

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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: 1

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

42-53: Optional: Only delete “older” files to reduce race risk with live SQLite sessions.

To be extra conservative, you can skip very recent files (e.g., last write < 1–5 minutes) in case a DB connection is about to reuse them. This reduces the chance of colliding with a still-active or just-about-to-be-active SQLite session, even though this is a temp fix.

Example inside the foreach, before delete:

var age = DateTime.UtcNow - File.GetLastWriteTimeUtc(file);
if (age < TimeSpan.FromMinutes(5))
{
    continue;
}

Would you like me to open a follow-up PR adding the “age threshold” guard and a small debug log for the number of files deleted?


48-48: Ignore spelling warnings for shm/wal.

The spell-checker warnings for “shm”/“wal” are expected technical terms (SQLite). Safe to ignore or add to the dictionary.

📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f244812 and 693636c.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (2)
Plugins/Flow.Launcher.Plugin.WindowsSettings/Log.cs (1)
  • Exception (15-18)
Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs (1)
  • LogException (489-492)
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

[warning] 48-48:
wal is not a recognized word. (unrecognized-spelling)


[warning] 48-48:
shm is not a recognized word. (unrecognized-spelling)


[warning] 48-48:
wal is not a recognized word. (unrecognized-spelling)


[warning] 48-48:
shm is not a recognized word. (unrecognized-spelling)


[warning] 48-48:
wal is not a recognized word. (unrecognized-spelling)


[warning] 48-48:
shm is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (1)

40-58: Pragmatic startup cleanup — aligns with PR objective.

Good short-term safeguard to prevent cache bloat by purging orphan SQLite WAL/SHM files before bookmark loading. Exception is logged and Init proceeds, so startup resilience is preserved.

@Jack251970 Jack251970 added Dev branch only An issue or fix for the Dev branch build and removed bug Something isn't working labels Aug 16, 2025
Copy link
Member

@Jack251970 Jack251970 left a comment

Choose a reason for hiding this comment

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

Good catch!

@Jack251970 Jack251970 merged commit 4b41578 into Flow-Launcher:dev Aug 16, 2025
9 checks passed
@Jack251970 Jack251970 added this to the 2.0.0 milestone Aug 16, 2025
@dcog989 dcog989 deleted the Clean-orphan-files,-temp-fix branch August 16, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dev branch only An issue or fix for the Dev branch build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants