Update: 2026-07-09 03:41:48

This commit is contained in:
Hamza-Ayed
2026-07-09 03:41:48 +03:00
parent 7dff7b6973
commit 70718946f5
10 changed files with 295 additions and 639 deletions
+13 -1
View File
@@ -119,7 +119,18 @@ try {
// --- Location Server Redis ---
$redisLocation = new Redis();
$locHost = getenv('REDIS_LOCATION_HOST') ?: $redisHost;
// 🔥 [Fix Silent Fallback] إذا لم تُضبط REDIS_LOCATION_HOST صراحة، نسقط
// على Redis الرئيسي — وهذا يجعل استعلامات كثافة السائقين (geo:drivers:*)
// ترجع فارغة بصمت لأن تلك المفاتيح تُكتب فقط على Redis الخاص بلوكيشن
// سيرفر. نسجّل تحذيراً واضحاً حتى لا يمر هذا دون ملاحظة في اللوجز.
$locHostConfigured = getenv('REDIS_LOCATION_HOST');
if (!$locHostConfigured) {
error_log('[REDIS] ⚠️ REDIS_LOCATION_HOST is not set — $redisLocation is falling back to the MAIN redis host (' . $redisHost . '). ' .
'geo:drivers:available / driver:profile:* / driver:public:* keys live only on the location-server Redis, ' .
'so driver-density lookups (getSpeed.php, heatmap_live.php, pricing/get.php) will silently return empty results ' .
'unless REDIS_LOCATION_HOST/PORT/PASSWORD are configured correctly in .env.');
}
$locHost = $locHostConfigured ?: $redisHost;
$locPort = (int)(getenv('REDIS_LOCATION_PORT') ?: $redisPort);
$locPass = getenv('REDIS_LOCATION_PASSWORD') ?: $redisPass;
@@ -127,6 +138,7 @@ try {
if ($locPass) $redisLocation->auth($locPass);
// No prefix for location server
} else {
error_log("[REDIS] ⚠️ Failed to connect \$redisLocation to $locHost:$locPort — driver-density features will be degraded.");
$redisLocation = null;
}
}