avoid using cache while getting/releasing a lock from DB
This commit is contained in:
parent
2cd40a80fe
commit
78e4d64658
|
@ -391,6 +391,10 @@ function mysql_db_process_sql($sql, $rettype='affected_rows', $dbconnection='',
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isset($config['dbcache']) === true) {
|
||||
$cache = $config['dbcache'];
|
||||
}
|
||||
|
||||
if ($cache && ! empty($sql_cache[$sql_cache['id']][$sql])) {
|
||||
$retval = $sql_cache[$sql_cache['id']][$sql];
|
||||
$sql_cache['saved'][$sql_cache['id']]++;
|
||||
|
|
|
@ -2188,6 +2188,12 @@ function db_check_minor_relase_available_to_um($package, $ent, $offline)
|
|||
*/
|
||||
function db_get_lock($lockname, $expiration_time=86400)
|
||||
{
|
||||
global $config;
|
||||
|
||||
// Temporary disable to get a valid lock if any...
|
||||
$cache = $config['dbcache'];
|
||||
$config['dbcache'] = false;
|
||||
|
||||
$lock_status = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT IS_FREE_LOCK("%s")',
|
||||
|
@ -2204,9 +2210,11 @@ function db_get_lock($lockname, $expiration_time=86400)
|
|||
)
|
||||
);
|
||||
|
||||
$config['dbcache'] = $cache;
|
||||
return $lock_status;
|
||||
}
|
||||
|
||||
$config['dbcache'] = $cache;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2222,12 +2230,21 @@ function db_get_lock($lockname, $expiration_time=86400)
|
|||
*/
|
||||
function db_release_lock($lockname)
|
||||
{
|
||||
return db_get_value_sql(
|
||||
global $config;
|
||||
$cache = $config['dbcache'];
|
||||
$config['dbcache'] = false;
|
||||
|
||||
$return = db_get_value_sql(
|
||||
sprintf(
|
||||
'SELECT RELEASE_LOCK("%s")',
|
||||
$lockname
|
||||
)
|
||||
);
|
||||
|
||||
$config['dbcache'] = $cache;
|
||||
|
||||
return $return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue