Skip to content

Commit 1c6e1d0

Browse files
authored
Merge pull request #68 from open-runtimes/feat-rotate-between-opr-networks
Rotate randomly between networks
2 parents 52d694a + 51a3e18 commit 1c6e1d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/http.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ function removeAllRuntimes(Table $activeRuntimes, Orchestration $orchestration):
482482
$codeMountPath = $version === 'v2' ? '/usr/code' : '/mnt/code';
483483
$workdir = $version === 'v2' ? '/usr/code' : '';
484484

485+
$openruntimes_networks = explode(',', str_replace(' ', '', Http::getEnv('OPR_EXECUTOR_NETWORK') ?: 'executor_runtimes'));
486+
$openruntimes_network = $openruntimes_networks[array_rand($openruntimes_networks)];
487+
485488
/** Keep the container alive if we have commands to be executed */
486489
$containerId = $orchestration->run(
487490
image: $image,
@@ -497,7 +500,7 @@ function removeAllRuntimes(Table $activeRuntimes, Orchestration $orchestration):
497500
\dirname($tmpSource) . ':/tmp:rw',
498501
\dirname($tmpBuild) . ':' . $codeMountPath . ':rw'
499502
],
500-
network: \strval(Http::getEnv('OPR_EXECUTOR_NETWORK', 'executor_runtimes')),
503+
network: \strval($openruntimes_network) ?: 'executor_runtimes',
501504
workdir: $workdir
502505
);
503506

0 commit comments

Comments
 (0)