| @@ 55-67 (lines=13) @@ | ||
| 52 | )) |
|
| 53 | ->exclude('ID', $dataTransfer->ID); |
|
| 54 | ||
| 55 | if($runningTransfers->count()) { |
|
| 56 | $runningTransfer = $runningTransfers->first(); |
|
| 57 | $log->write(sprintf( |
|
| 58 | '[-] Error: another transfer is in progress (started at %s by %s)', |
|
| 59 | $runningTransfer->dbObject('Created')->Nice(), |
|
| 60 | $runningTransfer->Author()->Title |
|
| 61 | )); |
|
| 62 | throw new RuntimeException(sprintf( |
|
| 63 | 'Another transfer is in progress (started at %s by %s)', |
|
| 64 | $runningTransfer->dbObject('Created')->Nice(), |
|
| 65 | $runningTransfer->Author()->Title |
|
| 66 | )); |
|
| 67 | } |
|
| 68 | ||
| 69 | ||
| 70 | // before we push data to an environment, we'll make a backup first |
|
| @@ 112-124 (lines=13) @@ | ||
| 109 | // Disallow concurrent deployments (don't rely on queuing implementation to restrict this) |
|
| 110 | // Only consider deployments started in the last 30 minutes (older jobs probably got stuck) |
|
| 111 | $runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']); |
|
| 112 | if($runningDeployments->count()) { |
|
| 113 | $runningDeployment = $runningDeployments->first(); |
|
| 114 | $log->write(sprintf( |
|
| 115 | '[-] Error: another deployment is in progress (started at %s by %s)', |
|
| 116 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 117 | $runningDeployment->Deployer()->Title |
|
| 118 | )); |
|
| 119 | throw new RuntimeException(sprintf( |
|
| 120 | 'Another deployment is in progress (started at %s by %s)', |
|
| 121 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 122 | $runningDeployment->Deployer()->Title |
|
| 123 | )); |
|
| 124 | } |
|
| 125 | ||
| 126 | $environment->Backend()->deploy( |
|
| 127 | $environment, |
|