Skip to content

Conversation

@nickvergessen
Copy link
Member

…uce concurrency issues

🛠️ API Checklist

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not possible
  • 📘 API documentation in docs/ has been updated or is not required
  • 🔖 Capability is added or not needed

@nickvergessen nickvergessen added this to the 🪺 Next Major (32) milestone Jul 23, 2025
@nickvergessen nickvergessen self-assigned this Jul 23, 2025
@nickvergessen nickvergessen added 3. to review bug feature: api 🛠️ OCS API for conversations, chats and participants feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings labels Jul 23, 2025
Comment on lines +356 to +372
$this->dbConnection->beginTransaction();
$inserted = $this->dbConnection->insertIfNotExist('*PREFIX*share', [
'share_type' => self::SHARE_TYPE_USERROOM,
'share_with' => $recipient,
'uid_owner' => $share->getShareOwner(),
'uid_initiator' => $share->getSharedBy(),
'parent' => $share->getId(),
'item_type' => $share->getNodeType(),
'item_source' => $share->getNodeId(),
'file_source' => $share->getNodeId(),
'file_target' => $share->getTarget(),
'permissions' => 0,
'stime' => $share->getShareTime()->getTimestamp(),
], ['share_type', 'share_with', 'parent']);
$this->dbConnection->commit();

if ($inserted === 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately wrapping insertIfNotExists in a transaction does not give more atomicity

nextcloud/server#54041 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

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

While that is sad, the reduced roundtrip time should help
And the change here in deleteFromSelf which updates ALL share_type+with+parent items instead of the first one found by ID should solve the issue we are facing at the moment:

  • After using "Unshare from self" and reloading the page, the share is visible again.
  • THat should be fixed, as now all items have permissions = 0 and are not mounted

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

Labels

3. to review bug feature: api 🛠️ OCS API for conversations, chats and participants feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants