LibreY

- privacy respecting meta search engine
git clone git://git.acid.vegas/LibreY.git
Log | Files | Refs | Archive | README | LICENSE

commit f8f30323eea53d12f25cd5f13c51cba481f9780c
parent 01fe9830098a7eb72e67e02eecdebe9b06992b44
Author: davidovski <david@davidovski.xyz>
Date: Wed, 30 Aug 2023 21:17:30 +0100

do not avoid request if cached

Diffstat:
Mengines/librex/fallback.php | 4+---
Mengines/text/text.php | 10+++++++---

2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/engines/librex/fallback.php b/engines/librex/fallback.php
@@ -1,7 +1,6 @@
 <?php
 
     class LibreXFallback extends EngineRequest {
-        protected $DO_CACHING = false;
         public function __construct($instance, $opts, $mh) {
             $this->instance = $instance;
             parent::__construct($opts, $mh);
@@ -54,8 +53,7 @@
                 continue;
 
             $librex_request = new LibreXFallback($instance, $opts, null);
-            error_log($librex_request->url);
-            
+
             $results = $librex_request->get_results();
 
             if (!empty($results))
diff --git a/engines/text/text.php b/engines/text/text.php
@@ -12,9 +12,6 @@
             if (substr($this->query, 0, 1) == "!" || substr($last_word_query, 0, 1) == "!")
                 check_ddg_bang($this->query, $opts);
 
-            if (has_cooldown($this->engine, $this->opts->cooldowns))
-                return;
-
             if ($this->engine == "google") {
                 
                 require "engines/text/google.php";
@@ -26,6 +23,13 @@
                 $this->engine_request = new DuckDuckGoRequest($opts, $mh);
             }
 
+            if (has_cooldown($this->engine, $this->opts->cooldowns) && !has_cached_results($this->engine_request->url)) {
+                // TODO dont add it in the first place
+                curl_multi_remove_handle($mh, $this->engine_request->ch);
+                return;
+            }
+
+
             require "engines/special/special.php";
             $this->special_request = get_special_search_request($opts, $mh);
         }