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

feat: external db reconnect #3221

Merged
merged 13 commits into from
Jun 19, 2024

Conversation

perfectra1n
Copy link
Contributor

@perfectra1n perfectra1n commented Jun 16, 2024

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

This builds off of #2666 that refused to cooperate with SQLite. Now the backend should automatically attempt to reconnect with the SQLite or Postgres DBs if the connection is dropped.

@perfectra1n perfectra1n marked this pull request as draft June 16, 2024 22:35
@RobinBially
Copy link

Not needed because of this: #3228. It's already in development.

@justinh-rahb
Copy link
Collaborator

Not needed because of this: #3228. It's already in development.

As of the last time I tested it, that earlier PR did not work properly if you were using the default SQLite database. I'll test this one later today when I have time to see if it addresses that issue.

@perfectra1n
Copy link
Contributor Author

perfectra1n commented Jun 17, 2024

@justinh-rahb, the issue that @RobinBially just excellently delivered as a comment, was opened ~5 hours ago (#3228). I believe you might be mistaking it for #2666.

@justinh-rahb
Copy link
Collaborator

@justinh-rahb, the PR that @RobinBially excellently delivered was open ~5 hours ago (#3228). I believe you might be mistaking it for #2666.

You're correct. I blame insufficient supply of caffeine

@perfectra1n
Copy link
Contributor Author

perfectra1n commented Jun 17, 2024

You're correct. I blame insufficient supply of caffeine

It's all good! I'm just hoping one of these 3 PRs pan out for open-webui. Good luck caffeinating further :)

@perfectra1n perfectra1n changed the title [DRAFT] feat: external db reconnect feat: external db reconnect Jun 17, 2024
@perfectra1n perfectra1n marked this pull request as ready for review June 17, 2024 15:57
@perfectra1n
Copy link
Contributor Author

Should be good to go now, verified it locally for both Postgres and SQLite. Tried on both completely new databases, and previously existing ones. Waited 15 minutes between new queries, repeated 3x times. Seems like it's finally working 🎉

Copy link
Contributor

@Peter-De-Ath Peter-De-Ath left a comment

Choose a reason for hiding this comment

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

I can't seem to break it.

Running with postgres database, I can now restart postgres and it no long requires to restart open-webui.

Running with SQLite localfile I can remove the database, It will attempt to create a new one, but if i replace it with the original it continues as expected.

Running with SQLite over a network connection i can break the connection and open-webui work once restored.

@perfectra1n
Copy link
Contributor Author

I can't seem to break it.

Running with postgres database, I can now restart postgres and it no long requires to restart open-webui.

Running with SQLite localfile I can remove the database, It will attempt to create a new one, but if i replace it with the original it continues as expected.

Running with SQLite over a network connection i can break the connection and open-webui work once restored.

That's great to hear! 💪

@tjbck
Copy link
Contributor

tjbck commented Jun 19, 2024

hell yeah brother

@tjbck
Copy link
Contributor

tjbck commented Jun 19, 2024

let's gooooo

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.

None yet

6 participants