Update: 2026-07-09 03:41:48
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user