diff --git a/config.dist.php b/config.dist.php index 744b3a9..d992d89 100644 --- a/config.dist.php +++ b/config.dist.php @@ -158,3 +158,13 @@ * @var string|null */ const DEBUG_LOG = DATA_ROOT . '/debug.log'; + +/** + * DB_QUERY_RUNNING_TIME_LIMIT + * Set the maximum time in seconds a database query is allowed to run. + * If a query takes longer than this, it will be aborted and an error will be returned + * + * Default: 30 + * @var int + */ +const DB_QUERY_RUNNING_TIME_LIMIT = 30; \ No newline at end of file diff --git a/server/_inc.php b/server/_inc.php index 69fe718..94406fd 100644 --- a/server/_inc.php +++ b/server/_inc.php @@ -44,6 +44,7 @@ class UserException extends \Exception {} 'TITLE' => 'My oPodSync server', 'DEBUG_LOG' => null, 'HTTP_SCHEME' => !empty($_SERVER['HTTPS']) || $_SERVER['SERVER_PORT'] == 443 ? 'https' : 'http', + 'DB_QUERY_RUNNING_TIME_LIMIT' => 30, ]; foreach ($defaults as $const => $value) { diff --git a/server/lib/OPodSync/GPodder.php b/server/lib/OPodSync/GPodder.php index 1d1cf5b..7fc7b61 100644 --- a/server/lib/OPodSync/GPodder.php +++ b/server/lib/OPodSync/GPodder.php @@ -362,7 +362,7 @@ public function updateAllFeeds(bool $cli = false): void $db = DB::getInstance(); foreach ($db->iterate($sql) as $row) { - @set_time_limit(30); // Extend running time; + @set_time_limit(DB_QUERY_RUNNING_TIME_LIMIT); // Extend running time; if ($cli) { printf("Updating %s\n", $row->url);