Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19524572
D21622.id51468.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21622.id51468.diff
View Options
diff --git a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
--- a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
+++ b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
@@ -93,20 +93,37 @@
return;
}
- id(new HarbormasterBuildCommand())
+ // establish separate connection to avoid HarbormasterBuildCommand
+ // being created in transaction which already is happening, otherwise
+ // Worker can be started before HarbormasterBuildCommand is committed
+ $conn = id(new HarbormasterBuildCommand())
+ ->establishConnection('w', $force_new = true);
+
+ $build_command = id(new HarbormasterBuildCommand())
+ ->setForcedConnection($conn)
->setAuthorPHID($xaction->getAuthorPHID())
->setTargetPHID($build->getPHID())
->setCommand($command)
->save();
- PhabricatorWorker::scheduleTask(
- 'HarbormasterBuildWorker',
- array(
- 'buildID' => $build->getID(),
- ),
- array(
- 'objectPHID' => $build->getPHID(),
- ));
+ try {
+ PhabricatorWorker::scheduleTask(
+ 'HarbormasterBuildWorker',
+ array(
+ 'buildID' => $build->getID(),
+ ),
+ array(
+ 'objectPHID' => $build->getPHID(),
+ ));
+ } catch (Exception $e) {
+ // if we can't schedule task, let's delete command
+ $build_command->delete();
+ throw $e;
+ } catch (Throwable $e) {
+ // if we can't schedule task, let's delete command
+ $build_command->delete();
+ throw $e;
+ }
}
protected function applyCustomExternalTransaction(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jan 19 2026, 2:23 AM (7 w, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
9002730
Default Alt Text
D21622.id51468.diff (1 KB)
Attached To
Mode
D21622: Avoid possible HarbormasterBuildCommand leaks during job restarts
Attached
Detach File
Event Timeline
Log In to Comment