Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Database transactions #199

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

Open
michaelprichardson wants to merge 37 commits into master
base: master
Choose a base branch
Loading
from database-transactions
Open

Conversation

@michaelprichardson
Copy link
Collaborator

@michaelprichardson michaelprichardson commented Jul 8, 2021

No description provided.

if (error == null && snapshot != null) {
deferred.complete(Result.success(DataSnapshot(snapshot)))
} else {
deferred.complete(Result.failure(Throwable(error?.message)))
Copy link
Member

Choose a reason for hiding this comment

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

we've got a database specific exception class you can throw here

michaelprichardson reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

michaelprichardson reacted with thumbs up emoji
Comment on lines 195 to 196
override fun doTransaction(currentData: MutableData) =
Transaction.success(transactionUpdate(decode(strategy, currentData)) as MutableData)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
override fun doTransaction(currentData: MutableData) =
Transaction.success(transactionUpdate(decode(strategy, currentData)) as MutableData)
override fun doTransaction(currentData: MutableData): Transaction.Result {
currentData.value = currentData.value?.let {
transactionUpdate(decode(strategy, it))
}
return Transaction.success(currentData)
}

I'm suggesting this change because I think transactions are not working.
We need to work with currentData.value, not with currentData itself.
Also we need to tolerate null value as described in the Firebase documentation.
I'm happy to help to update and merge this PR but I'm not sure I'll be able to do the same in js and iOS.

Copy link
Contributor

pauminku commented Jul 16, 2022
edited
Loading

(削除) Should this PR work on iOS? I'm getting this error: Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: illegal attempt to access non-shared <object>@xxxx from other thread (削除ここまで)

Copy link
Contributor

pauminku commented Jul 18, 2022
edited
Loading

(削除) I think to make this work on iOS we'll need to freeze the callback blocks: https://youtrack.jetbrains.com/issue/KT-43566 (削除ここまで)

Copy link
Collaborator

Reedyuk commented Jul 18, 2022
edited
Loading

I think to make this work on iOS we'll need to freeze the callback blocks: https://youtrack.jetbrains.com/issue/KT-43566

I wouldnt freeze it, you should be able to enable the new memory model and disable freezing.

https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md

kotlin.native.binary.memoryModel=experimental
kotlin.native.binary.freezing=disabled

Freezing will be deprecated in future version of Kotlin

pauminku reacted with thumbs up emoji pauminku reacted with heart emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@nbransby nbransby nbransby left review comments

@Reedyuk Reedyuk Reedyuk approved these changes

+1 more reviewer

@pauminku pauminku pauminku left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /