Race condition when subscribing to the same object in parallel
authorAlexander Ebert <ebert@woltlab.com>
Tue, 23 Feb 2021 09:27:07 +0000 (10:27 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 23 Feb 2021 09:27:07 +0000 (10:27 +0100)
wcfsetup/install/files/lib/data/user/object/watch/UserObjectWatchAction.class.php

index aa3031ca52f5594ad0375e79e71c507ff2424072..77ce4ade08d7a142aaf52543758123c20873f138 100644 (file)
@@ -87,7 +87,7 @@ class UserObjectWatchAction extends AbstractDatabaseObjectAction {
                if ($this->parameters['subscribe']) {
                        // newly subscribed
                        if ($this->userObjectWatch === null) {
-                               UserObjectWatchEditor::create([
+                               UserObjectWatchEditor::createOrIgnore([
                                        'notification' => $this->parameters['enableNotification'] ? 1 : 0,
                                        'objectID' => $this->parameters['objectID'],
                                        'objectTypeID' => $this->objectType->objectTypeID,