added wss tools 6

This commit is contained in:
2026-06-18 19:32:28 +03:30
parent dc440abf61
commit 017ab348c7
12 changed files with 133 additions and 90 deletions
@@ -18,9 +18,7 @@ class PriceStreamController extends Controller
abort(404);
}
$host = $service->resolveHost($request);
return response()->stream(function () use ($service, $host) {
return response()->stream(function () use ($service) {
@set_time_limit(0);
if (function_exists('apache_setenv')) {
@@ -46,15 +44,13 @@ class PriceStreamController extends Controller
$send('last', $last);
}
$lastId = $host !== '' ? $service->currentSeq($host) : 0;
$lastId = $service->currentSeq();
$heartbeatTicks = 0;
while (! connection_aborted()) {
if ($host !== '') {
foreach ($service->consumeSince($host, $lastId) as $event) {
$send((string) $event['event'], $event['data']);
$lastId = (int) $event['id'];
}
foreach ($service->consumeSince($lastId) as $event) {
$send((string) $event['event'], $event['data']);
$lastId = (int) $event['id'];
}
$heartbeatTicks++;
@@ -22,7 +22,6 @@ use Illuminate\Support\Facades\Mail;
use Morilog\Jalali\Jalalian;
use App\Services\ConfigService;
use App\Services\LivePriceCacheService;
use App\Services\PriceBroadcastService;
use App\Services\ProductDisplayPriceService;
@@ -133,10 +132,7 @@ class ReportController extends Controller
$cache = app(LivePriceCacheService::class);
$cache->markTick();
$result = $cache->put($payload);
app(PriceBroadcastService::class)->broadcastAfterPriceUpdate($result, true);
return $result;
return $cache->put($payload);
}
return $payload;