function _ip_geoloc_reverse_geocode_timeout in IP Geolocation Views & Maps 8
Same name and namespace in other branches
- 7 ip_geoloc.module \_ip_geoloc_reverse_geocode_timeout()
Handle timeout of the Google Maps reverse-geocode callback, if enabled.
This is based on $position_pending_since being set to the current time when the service was initiated.
File
- ./
ip_geoloc.module, line 460 - IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported and available through this module. Using a number of optional sources IPGV&M also retrieves…
Code
function _ip_geoloc_reverse_geocode_timeout() {
$pending_since = _ip_geoloc_get_session_value('position_pending_since');
if (isset($pending_since)) {
$time_elapsed = microtime(TRUE) - $pending_since;
if ($time_elapsed > IP_GEOLOC_CALLBACK_TIMEOUT) {
ip_geoloc_debug(t('IPGV&M timeout: the last reverse-geocode request was @sec s ago.', [
'@sec' => number_format($time_elapsed, 1),
]));
_ip_geoloc_set_session_value('position_pending_since', NULL);
return $time_elapsed;
}
}
return FALSE;
}