function httprl_cron in HTTP Parallel Request & Threading Library 7
Same name and namespace in other branches
- 6 httprl.module \httprl_cron()
Implements hook_cron().
This hook should be ran about once an hour to once every 5 minutes.
File
- ./
httprl.module, line 208 - HTTP Parallel Request Library module.
Code
function httprl_cron() {
// Let expiration times vary by 5 minutes.
$fuzz_factor = 300;
// Remove expired locks from the semaphore database table.
if (defined('VERSION') && substr(VERSION, 0, 1) >= 7) {
db_delete('semaphore')
->condition('value', 'httprl')
->condition('expire', REQUEST_TIME - $fuzz_factor, '<')
->execute();
}
else {
db_query("DELETE FROM {semaphore} WHERE value = 'httprl' AND expire < %f", time() - $fuzz_factor);
}
// Let expiration times vary by 60 minutes.
$fuzz_factor = 3600;
// Remove expired locks from the semaphore database table.
if (defined('VERSION') && substr(VERSION, 0, 1) >= 7) {
db_delete('semaphore')
->condition('name', db_like('httprl_') . '%', 'LIKE')
->condition('expire', REQUEST_TIME - $fuzz_factor, '<')
->execute();
}
else {
db_query("DELETE FROM {semaphore} WHERE name LIKE 'httprl_%' AND expire < %f", time() - $fuzz_factor);
}
}