forked from Cavemanon/cavepaintings
Added set_timeout to database and engine
This commit is contained in:
@@ -1049,9 +1049,7 @@ class Media extends Extension
|
||||
break;
|
||||
}
|
||||
|
||||
if ($database->get_driver_name()==DatabaseDriver::PGSQL) { // These updates can take a little bit
|
||||
$database->execute("SET statement_timeout TO 300000;");
|
||||
}
|
||||
$database->set_timeout(300000); // These updates can take a little bit
|
||||
|
||||
if ($database->transaction === true) {
|
||||
$database->commit(); // Each of these commands could hit a lot of data, combining them into one big transaction would not be a good idea.
|
||||
|
@@ -578,9 +578,7 @@ class Ratings extends Extension
|
||||
break;
|
||||
}
|
||||
|
||||
if ($database->get_driver_name()==DatabaseDriver::PGSQL) { // These updates can take a little bit
|
||||
$database->execute("SET statement_timeout TO 300000;");
|
||||
}
|
||||
$database->set_timeout(300000); // These updates can take a little bit
|
||||
|
||||
$database->execute("UPDATE images SET rating = :new WHERE rating = :old", ["new"=>'?', "old"=>'u' ]);
|
||||
|
||||
|
@@ -71,9 +71,7 @@ class Rule34 extends Extension
|
||||
{
|
||||
global $database, $page, $user;
|
||||
|
||||
if ($user->can(Permissions::DELETE_USER)) { // deleting users can take a while
|
||||
$database->execute("SET statement_timeout TO ".(DATABASE_TIMEOUT+15000).";");
|
||||
}
|
||||
$database->set_timeout(DATABASE_TIMEOUT+15000); // deleting users can take a while
|
||||
|
||||
if (function_exists("sd_notify_watchdog")) {
|
||||
sd_notify_watchdog();
|
||||
|
@@ -191,9 +191,7 @@ class Upgrade extends Extension
|
||||
break;
|
||||
}
|
||||
|
||||
if ($database->get_driver_name()==DatabaseDriver::PGSQL) { // These updates can take a little bit
|
||||
$database->execute("SET statement_timeout TO 300000;");
|
||||
}
|
||||
$database->set_timeout(300000); // These updates can take a little bit
|
||||
|
||||
log_info("upgrade", "Setting index for ext column");
|
||||
$database->execute('CREATE INDEX images_ext_idx ON images(ext)');
|
||||
|
Reference in New Issue
Block a user