Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
965ca5d5
Commit
965ca5d5
authored
Mar 06, 2019
by
Dominik Hebeler
Browse files
Waiting for a specified timeout if no main searchengines are defined
parent
568a3fb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/MetaGer.php
View file @
965ca5d5
...
...
@@ -706,8 +706,15 @@ class MetaGer
$timeStart
=
microtime
(
true
);
$answered
=
[];
$results
=
null
;
while
(
sizeof
(
$enginesToWaitFor
)
>
0
)
{
$newEngine
=
$redis
->
blpop
(
$this
->
redisResultWaitingKey
,
5
);
# 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"
))
{
$forceTimeout
=
1
;
}
while
(
sizeof
(
$enginesToWaitFor
)
>
0
||
(
$forceTimeout
!==
null
&&
(
microtime
(
true
)
-
$timeStart
)
<
$forceTimeout
))
{
$newEngine
=
$redis
->
blpop
(
$this
->
redisResultWaitingKey
,
1
);
if
(
$newEngine
===
null
||
sizeof
(
$newEngine
)
!==
2
)
{
continue
;
}
else
{
...
...
@@ -731,6 +738,13 @@ class MetaGer
$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"
);
}
...
...
resources/js/scriptResultPage.js
View file @
965ca5d5
...
...
@@ -103,7 +103,7 @@ function loadMoreResults() {
}
}
}
if
(
$
(
"
.no-results-error
"
).
length
>
0
&&
$
(
"
.image-container > .image
"
).
length
>
0
)
{
if
(
$
(
"
.no-results-error
"
).
length
>
0
&&
(
$
(
"
.image-container > .image
"
).
length
>
0
)
||
$
(
"
.result:not(.ad)
"
).
length
>
0
)
{
$
(
"
.no-results-error
"
).
remove
();
if
(
$
(
"
.alert.alert-danger > ul
"
).
children
().
length
==
0
)
{
$
(
"
.alert.alert-danger
"
).
remove
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment