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

openDatabase issue after HotReload #165

Open
alextekartik opened this issue May 18, 2020 · 2 comments
Open

openDatabase issue after HotReload #165

alextekartik opened this issue May 18, 2020 · 2 comments

Comments

@alextekartik
Copy link
Collaborator

From @deakjahn
Is it a known limitation that await _dbFactory.openDatabase() (web factory) never returns after a hot reload? I don't have the slightest problem with it on first run but after the first reload, the next line will never be reached. No log, nothing, just stops in the tracks.

@alextekartik
Copy link
Collaborator Author

alextekartik commented May 18, 2020

@deakjahn Hot reload should not be an issue, and in fact, if you keep a reference to the database, you should not open it again. I recommend like sqlite to open a database on start and close on stop.

I'd like to be able to reproduce but I'm not sure what to even try. Can you elaborate your scenario (why are you calling openDatabase after hot restart)?

  • Are you reopening an existing database already opened?
  • Are you opening a database you have closed before?
  • Do you have multiple databases opened?
  • Can you confirm you in a hot-reload (and not hot-restart) scenario?

@deakjahn
Copy link

deakjahn commented May 18, 2020

I don't normally reopen the database but I do under specific circumstances. Namely, if the user initiates a reset in the settings, that means I have to reload the database (possibly with different data than it had before).

When this happens, I call my database refresh routine that:

  • first closes the database, if not null.

  • then tries to open it again with DatabaseMode.empty. This is what doesn't work if we are after the reload. On first run, it's perfect. Both calls await properly, I don't usually commit the same error twice. ;-))

Not really a serious issue, I don't do that regularly and restarting the whole app is but a small nuisance. And it's web only. And it doesn't influence the user, of course.

Yes, I have three databases normally open. The refresh routine deals with them one by one: close, re-open, transaction. Close, re-open, transaction.

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

No branches or pull requests

2 participants