| @@ 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 |
|
| @@ 30-42 (lines=13) @@ | ||
| 27 | // Disallow concurrent deployments (don't rely on queuing implementation to restrict this) |
|
| 28 | // Only consider deployments started in the last 30 minutes (older jobs probably got stuck) |
|
| 29 | $runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']); |
|
| 30 | if($runningDeployments->count()) { |
|
| 31 | $runningDeployment = $runningDeployments->first(); |
|
| 32 | $log->write(sprintf( |
|
| 33 | '[-] Error: another deployment is in progress (started at %s by %s)', |
|
| 34 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 35 | $runningDeployment->Deployer()->Title |
|
| 36 | )); |
|
| 37 | throw new RuntimeException(sprintf( |
|
| 38 | 'Another deployment is in progress (started at %s by %s)', |
|
| 39 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 40 | $runningDeployment->Deployer()->Title |
|
| 41 | )); |
|
| 42 | } |
|
| 43 | ||
| 44 | $environment->Backend()->deploy( |
|
| 45 | $environment, |
|