fix(settings): push trading-hours changes to live user prices immediately
Recompute home price display on save, broadcast settings over SSE, and keep last-price status in sync without a user refresh. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -45,12 +45,7 @@ class LivePriceCacheService
|
||||
return $cachedBody;
|
||||
}
|
||||
|
||||
Cache::put(self::FULL_RESPONSE_KEY, [
|
||||
'body' => $body,
|
||||
'stored_at' => now(),
|
||||
], now()->addSeconds(self::TTL_SECONDS + 5));
|
||||
|
||||
app(ProductDisplayPriceService::class)->cacheLivePricePayload($body);
|
||||
$this->storeBody($body);
|
||||
|
||||
app(PriceBroadcastService::class)->broadcastLastIfChanged($body);
|
||||
|
||||
@@ -59,6 +54,32 @@ class LivePriceCacheService
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* بازنویسی کش last بدون گیت هویت — برای اعمال فوری ساعت کاری.
|
||||
*
|
||||
* @param array<string, mixed> $body
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function replaceBody(array $body): array
|
||||
{
|
||||
$this->storeBody($body);
|
||||
|
||||
return $body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $body
|
||||
*/
|
||||
private function storeBody(array $body): void
|
||||
{
|
||||
Cache::put(self::FULL_RESPONSE_KEY, [
|
||||
'body' => $body,
|
||||
'stored_at' => now(),
|
||||
], now()->addSeconds(self::TTL_SECONDS + 5));
|
||||
|
||||
app(ProductDisplayPriceService::class)->cacheLivePricePayload($body);
|
||||
}
|
||||
|
||||
public function markTick(): void
|
||||
{
|
||||
Cache::put(self::LAST_TICK_KEY, now(), now()->addMinutes(10));
|
||||
|
||||
Reference in New Issue
Block a user