| @@ 60-72 (lines=13) @@ | ||
| 57 | )) |
|
| 58 | ->exclude('ID', $dataTransfer->ID); |
|
| 59 | ||
| 60 | if($runningTransfers->count()) { |
|
| 61 | $runningTransfer = $runningTransfers->first(); |
|
| 62 | $log->write(sprintf( |
|
| 63 | '[-] Error: another transfer is in progress (started at %s by %s)', |
|
| 64 | $runningTransfer->dbObject('Created')->Nice(), |
|
| 65 | $runningTransfer->Author()->Title |
|
| 66 | )); |
|
| 67 | throw new RuntimeException(sprintf( |
|
| 68 | 'Another transfer is in progress (started at %s by %s)', |
|
| 69 | $runningTransfer->dbObject('Created')->Nice(), |
|
| 70 | $runningTransfer->Author()->Title |
|
| 71 | )); |
|
| 72 | } |
|
| 73 | ||
| 74 | ||
| 75 | // before we push data to an environment, we'll make a backup first |
|
| @@ 35-47 (lines=13) @@ | ||
| 32 | // Disallow concurrent deployments (don't rely on queuing implementation to restrict this) |
|
| 33 | // Only consider deployments started in the last 30 minutes (older jobs probably got stuck) |
|
| 34 | $runningDeployments = $environment->runningDeployments()->exclude('ID', $this->args['deploymentID']); |
|
| 35 | if($runningDeployments->count()) { |
|
| 36 | $runningDeployment = $runningDeployments->first(); |
|
| 37 | $log->write(sprintf( |
|
| 38 | '[-] Error: another deployment is in progress (started at %s by %s)', |
|
| 39 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 40 | $runningDeployment->Deployer()->Title |
|
| 41 | )); |
|
| 42 | throw new RuntimeException(sprintf( |
|
| 43 | 'Another deployment is in progress (started at %s by %s)', |
|
| 44 | $runningDeployment->dbObject('Created')->Nice(), |
|
| 45 | $runningDeployment->Deployer()->Title |
|
| 46 | )); |
|
| 47 | } |
|
| 48 | ||
| 49 | $environment->Backend()->deploy( |
|
| 50 | $environment, |
|