-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix deleteDatabase blocking due to open connections #144
Fix deleteDatabase blocking due to open connections #144
Conversation
06c1231
to
ead7323
Compare
If there's anything we'll need to change to allow this to merge, please feel free to contact me, currently this is blocking us quite a bit :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, last week was quite busy and I had to do some research to understand exactly what was happening. The IDB event names were not intuitive to me 😅.
We don't have a public facing style guide (yet? I'll look into it apparently I was wrong, relevant portion here), but could you please replace the !!
with checkNotNull
? Our convention is to use !!
when the value is guaranteed non-null but the compiler can't figure it out, and checkNotNull
when things shouldn't be null but might be due to logic errors. I'll approve after that, thanks for handling this
302a190
to
546fc9c
Compare
I was wondering if I should document them in the code, looks like I should've! Added that now.
I hope the way I did it now is fine, adding an internal fun ensureDatabase(): IDBDatabase = checkNotNull(database) { "database is closed" } |
- Automatically close database connections on delete - Handle "blocked" event in deleteDatabase
546fc9c
to
7fc7385
Compare
database.addEventListener("close", { close() }) | ||
} | ||
|
||
internal fun ensureDatabase(): IDBDatabase = checkNotNull(database) { "database is closed" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, love that it gives us a description
Automatically close database connections on delete
Handle "blocked" event in deleteDatabase