Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
443f0984
Commit
443f0984
authored
5 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
fixed a bug when waiting for searchengines
parent
b05b9fa9
No related branches found
No related tags found
3 merge requests
!1509
Development
,
!1508
Development
,
!1507
Resolve "Implement Timing output"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/MetaGer.php
+4
-20
4 additions, 20 deletions
app/MetaGer.php
with
4 additions
and
20 deletions
app/MetaGer.php
+
4
−
20
View file @
443f0984
...
...
@@ -788,19 +788,20 @@ class MetaGer
$mainEngines
=
$this
->
sumaFile
->
foki
->
{
$this
->
fokus
}
->
main
;
foreach
(
$mainEngines
as
$mainEngine
)
{
foreach
(
$engines
as
$engine
)
{
if
(
$engine
->
name
===
$mainEngine
)
{
if
(
$engine
->
name
===
$mainEngine
&&
!
$engine
->
loaded
)
{
$enginesToWaitFor
[]
=
$engine
;
}
}
}
$timeStart
=
microtime
(
true
);
$answered
=
[];
$results
=
null
;
# If there is no main searchengine to wait for or if the only main engine is yahoo-ads we will define a timeout of 1s
$forceTimeout
=
null
;
if
(
sizeof
(
$enginesToWaitFor
)
===
0
||
(
sizeof
(
$enginesToWaitFor
)
===
1
&&
$enginesToWaitFor
[
0
]
->
name
===
"yahoo-ads"
)
)
{
if
(
sizeof
(
$enginesToWaitFor
)
===
1
&&
$enginesToWaitFor
[
0
]
->
name
===
"yahoo-ads"
)
{
$forceTimeout
=
1
;
}
...
...
@@ -812,30 +813,13 @@ class MetaGer
break
;
}
}
if
((
microtime
(
true
)
-
$timeStart
)
>=
2
)
{
break
;
}
else
{
usleep
(
50
*
1000
);
}
}
# Now we can add an entry to Redis which defines the starting time and how many engines should answer this request
/*
$pipeline = $redis->pipeline();
$pipeline->hset($this->getRedisEngineResult() . "status", "startTime", $timeStart);
$pipeline->hset($this->getRedisEngineResult() . "status", "engineCount", sizeof($engines));
$pipeline->hset($this->getRedisEngineResult() . "status", "engineDelivered", sizeof($answered));
# Add the cached engines as answered
foreach ($engines as $engine) {
if ($engine->cached) {
$pipeline->hincrby($this->getRedisEngineResult() . "status", "engineDelivered", 1);
$pipeline->hincrby($this->getRedisEngineResult() . "status", "engineAnswered", 1);
}
}
foreach ($answered as $engine) {
$pipeline->hset($this->getRedisEngineResult() . $engine, "delivered", "1");
}
$pipeline->execute();*/
}
public
function
retrieveResults
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment