commit 30/9
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-09-30 09:05:43 +02:00
parent 67dad461d9
commit 3dc7c5c649
75 changed files with 4123 additions and 107 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Services\Mne;
use App\Jobs\CompareMneBusiness;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
final class CompatibilityShadow
{
/** Invoke only after authorization; optional comparison must never affect the response. */
public function schedule(string $businessId): void
{
if (! config('existing-business.compatibility_shadow', false)) {
return;
}
try {
$control = DB::transaction(fn () => DB::table('mne.compatibility_controls')->where('capability', 'shadow')->first());
if (! $control || ! $control->enabled || (hexdec(substr(hash('sha256', $businessId), 0, 6)) % 100) >= $control->percentage) {
return;
}
$connection = (string) config('existing-business.shadow_queue', 'database');
if (config('queue.connections.'.$connection.'.driver') !== 'database') {
Log::info('mne.compatibility.shadow', ['outcome' => 'async_queue_required']);
return;
}
CompareMneBusiness::dispatch($businessId)->onConnection($connection)->onQueue('mne-shadow')->afterCommit();
} catch (\Throwable) {
Log::info('mne.compatibility.shadow', ['outcome' => 'dispatch_error']);
}
}
}