Skip to content

Commit 19eada9

Browse files
committed
Server Group
1 parent f932f62 commit 19eada9

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

src/Core/SupervisorGenerator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public function generate()
2626
return $name !== 'sync';
2727
});
2828

29+
$hostname = gethostname();
30+
31+
$configs = array_filter($configs, function ($config) use ($hostname) {
32+
if (!$config->server_group) {
33+
return true;
34+
}
35+
36+
return substr($hostname, 0, strlen($config->server_group)) === $config->server_group;
37+
});
38+
2939
foreach ($configs as $config) {
3040
$connectionName = config('queue.default');
3141
if ($config->connection && $config->connection !== 'default') {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Schema;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
class QueueConfigAddServerGroup extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('queue_config', function (Blueprint $table) {
17+
$table->string('server_group')->nullable();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('queue_config', function (Blueprint $table) {
29+
$table->dropColumn('server_group');
30+
});
31+
}
32+
}

0 commit comments

Comments
 (0)