X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=update_daemon2.php;h=9d948a64d3c5cdea2e19cea5e1fcfa8d9f04c5ae;hb=f73e03e000d7119b8c9724790e70e4da4fb32cfe;hp=7692eb93030c0ec583cfb229ebdcda8fa35bb71f;hpb=8cabc200d5f50327641c6c3ee615095f632afd87;p=tt-rss.git diff --git a/update_daemon2.php b/update_daemon2.php index 7692eb93..9d948a64 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -170,14 +170,15 @@ "Maybe another daemon is already running.\n"); } - init_plugins(); - $schema_version = get_schema_version(); if ($schema_version != SCHEMA_VERSION) { die("Schema version is wrong, please upgrade the database.\n"); } + // Protip: children close shared database handle when terminating, it's a bad idea to + // do database stuff on main process from now on. + while (true) { // Since sleep is interupted by SIGCHLD, we need another way to @@ -190,17 +191,6 @@ } if ($last_checkpoint + $spawn_interval < time()) { - - /* Check if schema version changed */ - - $test_schema_version = get_schema_version(); - - if ($test_schema_version != $schema_version) { - echo "Expected schema version: $schema_version, got: $test_schema_version\n"; - echo "Schema version changed while we were running, bailing out\n"; - exit(100); - } - check_ctimes(); reap_children(); @@ -213,6 +203,7 @@ if (!$master_handlers_installed) { _debug("[MASTER] installing shutdown handlers"); pcntl_signal(SIGINT, 'sigint_handler'); + pcntl_signal(SIGTERM, 'sigint_handler'); register_shutdown_function('shutdown', posix_getpid()); $master_handlers_installed = true; }