chart fixed
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Http\Controllers\Site\ReportController;
|
||||
use App\Models\PriceSyncLog;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
@@ -12,13 +13,15 @@ class LivePriceTickService
|
||||
{
|
||||
private const LOCK_SECONDS = 25;
|
||||
|
||||
public function tick(): void
|
||||
public function tick(): ?PriceSyncLog
|
||||
{
|
||||
$lock = Cache::lock('prices:tick', self::LOCK_SECONDS);
|
||||
if (! $lock->get()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$syncLog = null;
|
||||
|
||||
try {
|
||||
$config = app(ConfigService::class);
|
||||
$sync = app(ProductPriceSyncService::class);
|
||||
@@ -73,15 +76,22 @@ class LivePriceTickService
|
||||
->whereNotNull('reading_method')
|
||||
->count();
|
||||
|
||||
app(PriceSyncLogService::class)->recordTick($source, $sourceUrl, $liquidGold, $activeProducts);
|
||||
$syncLog = app(PriceSyncLogService::class)->recordTick($source, $sourceUrl, $liquidGold, $activeProducts);
|
||||
|
||||
if ($payload !== []) {
|
||||
app(PriceSnapshotService::class)->recordTick($payload);
|
||||
}
|
||||
|
||||
app(LivePriceCacheService::class)->markTick();
|
||||
|
||||
$broadcastPayload = $payload;
|
||||
dispatch(function () use ($broadcastPayload) {
|
||||
app(PriceBroadcastService::class)->broadcastAfterPriceUpdate($broadcastPayload);
|
||||
})->afterResponse();
|
||||
} finally {
|
||||
$lock->release();
|
||||
}
|
||||
|
||||
return $syncLog;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user