viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

try to reduce number of open files feeds, a=chris

Chris Pollett [2019-12-25 21:Dec:th]
try to reduce number of open files feeds, a=chris
Filename
src/controllers/components/CrawlComponent.php
src/library/IndexManager.php
diff --git a/src/controllers/components/CrawlComponent.php b/src/controllers/components/CrawlComponent.php
index 9e9ef8b80..7e86c1b1c 100644
--- a/src/controllers/components/CrawlComponent.php
+++ b/src/controllers/components/CrawlComponent.php
@@ -2313,8 +2313,10 @@ class CrawlComponent extends Component implements CrawlConstants
                     ];
                     $head_string = "";
                     foreach ($page_defaults as $key => $default) {
+                        $value = (empty($head_vars[$key])) ? $default :
+                            $head_vars[$key];
                         $head_string .= urlencode($key) . "=" .
-                            urlencode($head_vars[$key]) . "\n\n";
+                            urlencode($value) . "\n\n";
                     }
                     $_REQUEST["KWIKI_PAGE"] = $kwiki_page;
                     if (!empty($kwiki_page)) {
diff --git a/src/library/IndexManager.php b/src/library/IndexManager.php
index a559a538c..5330e26f2 100644
--- a/src/library/IndexManager.php
+++ b/src/library/IndexManager.php
@@ -215,8 +215,16 @@ class IndexManager implements CrawlConstants
                 $active_shard_file = $index->dir_name .
                     "/posting_doc_shards/index" . $active_generation;
                 if (file_exists($active_shard_file)) {
-                    $active_shard = new IndexShard($active_shard_file, 0,
-                        C\NUM_DOCS_PER_GENERATION, true);
+                    if (!empty($index->non_merged_shard) &&
+                        !empty($index->non_merged_generation) &&
+                        $index->non_merged_generation == $active_generation) {
+                        $active_shard = $index->non_merged_shard;
+                    } else {
+                        $active_shard = new IndexShard($active_shard_file, 0,
+                            C\NUM_DOCS_PER_GENERATION, true);
+                        $index->non_merged_shard = $active_shard;
+                        $index->non_merged_generation = $active_generation;
+                    }
                     $active_info = $active_shard->getWordInfo($hash, true,
                         $shift);
                     if (is_array($active_info)) {
ViewGit