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

Always use the local cached copy first #391

Closed
jasperweiss opened this issue Oct 11, 2024 · 3 comments
Closed

Always use the local cached copy first #391

jasperweiss opened this issue Oct 11, 2024 · 3 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@jasperweiss
Copy link

jasperweiss commented Oct 11, 2024

I think this is similar to #373 but as of 1.53.154 KeePassium should support background refresh.
However, I still often run into a situation where I want to autofill something and KeePassium says "Downloading database file.." which then stays stuck on 0% because internet connectivity is poor. I thought the new release was supposed to use the local copy on startup and perform the fetch in the background?
When there is no internet (as in airplane mode), KeePassium opens up the local copy right away but with internet, it will try to load the online version at startup. This is quite annoying when internet isn't working (imagine being on a captive portal, or a concrete building with poor mobile data connectivity trying to enter your WPA enterprise credentials, which you need to get from KeePassium)

Would it be possible to really only retrieve the online copy in the background? Such that the "downloading database file.." screen is gone altogether during startup and autofill? Cancelling the manual refresh (if it's stuck due to poor internet) should maybe also not discard the local copy and just direct back to the opened database instead of it being closed.

I use the direct connection to OneDrive, if that matters.

@jasperweiss jasperweiss added the enhancement New feature or request label Oct 11, 2024
@keepassium
Copy link
Owner

I thought the new release was supposed to use the local copy on startup and perform the fetch in the background?

Not quite.

Background refresh introduced in 1.53 applies when you switch to KeePassium from other apps, when KeePassium already has a database loaded. It does not fetch the database in background, it only checks if the remote file is different from the loaded version — and offers a one-button manual reload if so. Which triggers the full fetch, decryption and caching.

Background refresh does not apply to the initial loading, which always fetches the remote database. It also does not apply to AutoFill at all — because AutoFill always launches zero, it's not possible to "switch back" to it.

Would it be possible to really only retrieve the online copy in the background?

This would not help too much in AutoFill… If it starts with the local cached copy, you would be done with AutoFill long before it manages to fetch anything in background.


Regarding the delay, there is already an existing mechanism to avoid delays on slow connections:

If your database is on a slow online storage, AutoFill may take a long time. You can improve AutoFill latency by forcing it to use the cached copy of the database:

  • Consider File Unreachable → Immediately
  • If File is Unreachable → Use Local Copy

You can also use a 1-second delay to give it a chance to actually fetch the database when there is a fast connection.

Give it a try and if something does not work right there, we can fine-tune that. But rebuilding the whole architecture of working with files (i.e. "start with remote") is unlikely to happen.

P.S. I think this is indeed a duplicate of #373.

@jasperweiss
Copy link
Author

Background refresh introduced in 1.53 applies when you switch to KeePassium from other apps, when KeePassium already has a database loaded.

Ah that makes sense. This helps to prevent version conflicts whereas the way I envisioned it would only cause more version conflicts (which I assume is why the local copy is read-only)

there is already an existing mechanism to avoid delays on slow connections

Ah yes, the database settings. With auto-open it's something you easily forget exists ^_^

So I set the timeout to 1 second and it seems it does not actually timeout after 1 second, but after a full minute or so (in the app itself and autofill). Tapping 'cancel' does not seem to do anything. I'd expect that to just skip through to the local copy straight away.
Setting it to immediately does work though. But 1 second would indeed be better.

So in conclusion, Consider File Unreachable does not seem to do anything unless it is set to immediately and tapping cancel does not work either. Again, using the direct OneDrive connection. (To test this I broke my internet by setting the DNS to localhost, but the same thing happens when my train goes underground)

@keepassium
Copy link
Owner

@jasperweiss , sorry for the slow response.

Based on your feedback, I have created two issues: one for the timeout being broken, and one to manually switch to local copy when database loading takes too long. This should help both with the original issue (being stuck waiting for database) and the broken workaround I suggested :)

However, the suggestion to start with the cached copy and loading the remote DB in background will not be worked on. (As I mentioned, it would go against a key assumption in app architecture, which is too complicated to change at this stage.) So I'll close this as "won't fix" and we can focus on the two issues above.

@keepassium keepassium closed this as not planned Won't fix, can't repro, duplicate, stale Nov 4, 2024
@keepassium keepassium added the wontfix This will not be worked on label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants