| @@ 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 |
|
| @@ 88-100 (lines=13) @@ | ||
| 85 | // Disallow concurrent deployments (don't rely on queuing implementation to restrict this) |
|
| 86 | // Only consider deployments started in the last 30 minutes (older jobs probably got stuck) |
|
| 87 | $runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']); |
|
| 88 | if($runningDeployments->count()) { |
|
| 89 | $runningDeployment = $runningDeployments->first(); |
|
| 90 | $log->write(sprintf( |
|
| 91 | '[-] Error: another deployment is in progress (started at %s by %s)', |
|
| 92 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 93 | $runningDeployment->Deployer()->Title |
|
| 94 | )); |
|
| 95 | throw new RuntimeException(sprintf( |
|
| 96 | 'Another deployment is in progress (started at %s by %s)', |
|
| 97 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 98 | $runningDeployment->Deployer()->Title |
|
| 99 | )); |
|
| 100 | } |
|
| 101 | ||
| 102 | $environment->Backend()->deploy( |
|
| 103 | $environment, |
|