-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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(contactsinteraction): Read, update or insert in DB transaction #37933
Merged
ChristophWurst
merged 2 commits into
master
from
fix/contactsinteraction/transactional-read-update-insert
May 12, 2023
Merged
fix(contactsinteraction): Read, update or insert in DB transaction #37933
ChristophWurst
merged 2 commits into
master
from
fix/contactsinteraction/transactional-read-update-insert
May 12, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The transaction guarantees there are no two concurrent inserts for the same interaction. Signed-off-by: Christoph Wurst <[email protected]>
if ($event->getFederatedCloudId() !== null) { | ||
$contact->setFederatedCloudId($event->getFederatedCloudId()); | ||
} | ||
$contact->setLastContact($this->timeFactory->getTime()); |
Check notice
Code scanning / Psalm
DeprecatedMethod
The method OCP\AppFramework\Utility\ITimeFactory::getTime has been marked as deprecated
$event->getFederatedCloudId() | ||
); | ||
if (!empty($existing)) { | ||
$now = $this->timeFactory->getTime(); |
Check notice
Code scanning / Psalm
DeprecatedMethod
The method OCP\AppFramework\Utility\ITimeFactory::getTime has been marked as deprecated
Signed-off-by: Christoph Wurst <[email protected]>
JohannesGGE
approved these changes
May 2, 2023
st3iny
approved these changes
May 2, 2023
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.
🧹
st3iny
added
4. to release
Ready to be released and/or waiting for tests to finish
and removed
3. to review
Waiting for reviews
labels
May 2, 2023
8 tasks
This was referenced May 3, 2023
Merged
Closed
Merged
ChristophWurst
deleted the
fix/contactsinteraction/transactional-read-update-insert
branch
May 12, 2023 12:02
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The transaction guarantees there are no two concurrent inserts for the same interaction.
I have not seen a conflict in production. I just noticed that this code is prone to fail in rare cases.
This is best reviewed as https://github.com/nextcloud/server/pull/37933/files?w=1
TODO
Checklist