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
acdf9494
Commit
acdf9494
authored
May 10, 2017
by
Dominik Hebeler
Browse files
Boost Knopf von der Startseite entfernt
Weitere Bugfixes in den Fetchern
parent
82961efe
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/Jobs/Searcher.php
View file @
acdf9494
...
@@ -14,7 +14,7 @@ class Searcher implements ShouldQueue
...
@@ -14,7 +14,7 @@ class Searcher implements ShouldQueue
{
{
use
InteractsWithQueue
,
Queueable
,
SerializesModels
;
use
InteractsWithQueue
,
Queueable
,
SerializesModels
;
protected
$name
,
$ch
,
$pid
,
$counter
,
$lastTime
;
protected
$name
,
$ch
,
$pid
,
$counter
,
$lastTime
,
$connectionInfo
;
protected
$MAX_REQUESTS
=
100
;
protected
$MAX_REQUESTS
=
100
;
protected
$importantEngines
=
array
(
"Fastbot"
,
"overture"
,
"overtureAds"
);
protected
$importantEngines
=
array
(
"Fastbot"
,
"overture"
,
"overtureAds"
);
protected
$recheck
;
protected
$recheck
;
...
@@ -64,9 +64,7 @@ class Searcher implements ShouldQueue
...
@@ -64,9 +64,7 @@ class Searcher implements ShouldQueue
$this
->
updateStats
(
microtime
(
true
)
-
$time
);
$this
->
updateStats
(
microtime
(
true
)
-
$time
);
$this
->
switchToRunning
();
$this
->
switchToRunning
();
// The mission can be empty when blpop hit the timeout
// The mission can be empty when blpop hit the timeout
if
(
empty
(
$mission
)){
if
(
!
empty
(
$mission
)){
continue
;
}
else
{
$mission
=
$mission
[
1
];
$mission
=
$mission
[
1
];
$poptime
=
microtime
(
true
)
-
$time
;
$poptime
=
microtime
(
true
)
-
$time
;
...
@@ -121,7 +119,7 @@ class Searcher implements ShouldQueue
...
@@ -121,7 +119,7 @@ class Searcher implements ShouldQueue
}
}
}
}
private
function
updateStats
(
$poptime
){
private
function
updateStats
(
$poptime
){
$connectionInfo
=
base64_encode
(
json_encode
(
curl_getinfo
(
$this
->
ch
),
true
));
$connectionInfo
=
base64_encode
(
json_encode
(
$this
->
connectionInfo
));
Redis
::
hset
(
$this
->
name
.
".stats"
,
$this
->
pid
,
$connectionInfo
.
";"
.
$poptime
);
Redis
::
hset
(
$this
->
name
.
".stats"
,
$this
->
pid
,
$connectionInfo
.
";"
.
$poptime
);
}
}
...
@@ -144,8 +142,8 @@ class Searcher implements ShouldQueue
...
@@ -144,8 +142,8 @@ class Searcher implements ShouldQueue
private
function
retrieveUrl
(
$url
){
private
function
retrieveUrl
(
$url
){
// Set this URL to the Curl handle
// Set this URL to the Curl handle
curl_setopt
(
$this
->
ch
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$this
->
ch
,
CURLOPT_URL
,
$url
);
$result
=
curl_exec
(
$this
->
ch
);
$result
=
curl_exec
(
$this
->
ch
);
$this
->
connectionInfo
=
curl_getinfo
(
$this
->
ch
);
return
$result
;
return
$result
;
}
}
...
...
app/Models/Searchengine.php
View file @
acdf9494
...
@@ -155,6 +155,7 @@ abstract class Searchengine
...
@@ -155,6 +155,7 @@ abstract class Searchengine
// of course need to spawn a new one.
// of course need to spawn a new one.
if
(
sizeof
(
$searcherData
)
===
0
){
if
(
sizeof
(
$searcherData
)
===
0
){
$needSearcher
=
true
;
$needSearcher
=
true
;
Log
::
info
(
"Request new Searcher beacause none is running"
);
}
else
{
}
else
{
// There we go:
// There we go:
// There's at least one Fetcher running for this search engine.
// There's at least one Fetcher running for this search engine.
...
@@ -170,6 +171,7 @@ abstract class Searchengine
...
@@ -170,6 +171,7 @@ abstract class Searchengine
$median
/=
sizeof
(
$searcherData
);
$median
/=
sizeof
(
$searcherData
);
if
(
$median
<
.1
){
if
(
$median
<
.1
){
$needSearcher
=
true
;
$needSearcher
=
true
;
Log
::
info
(
"Requesting new Searcher because:
$median
\n
"
.
print_r
(
$searcherData
,
true
));
}
}
}
}
if
(
$needSearcher
&&
Redis
::
get
(
$this
->
name
)
!==
"locked"
){
if
(
$needSearcher
&&
Redis
::
get
(
$this
->
name
)
!==
"locked"
){
...
...
resources/views/index.blade.php
View file @
acdf9494
...
@@ -304,8 +304,6 @@
...
@@ -304,8 +304,6 @@
</
form
>
</
form
>
</
fieldset
>
</
fieldset
>
<
ul
class
=
"list-inline searchform-bonus"
>
<
ul
class
=
"list-inline searchform-bonus"
>
<
li
><
a
href
=
"https://www.boost-project.com/de/shops?charity_id=1129&tag=bl"
target
=
"_blank"
rel
=
"noopener"
id
=
"foerdershops"
class
=
"btn btn-default mutelink"
title
=
"{{ trans('index.partnertitle') }}"
><
i
class
=
"fa fa-shopping-bag"
aria
-
hidden
=
"true"
></
i
>
{{
trans
(
'index.conveyor'
)
}}
</
a
></
li
>
<
li
class
=
"hidden-xs seperator"
>|</
li
>
<
li
id
=
"plug"
<
li
id
=
"plug"
@
unless
(
$browser
===
'Firefox'
||
$browser
===
'Mozilla'
||
$browser
===
'Chrome'
||
$browser
===
'Opera'
||
$browser
===
'IE'
||
$browser
===
'Edge'
||
$browser
===
'Safari'
||
$browser
===
'Vivaldi'
)
@
unless
(
$browser
===
'Firefox'
||
$browser
===
'Mozilla'
||
$browser
===
'Chrome'
||
$browser
===
'Opera'
||
$browser
===
'IE'
||
$browser
===
'Edge'
||
$browser
===
'Safari'
||
$browser
===
'Vivaldi'
)
class
=
"hidden"
class
=
"hidden"
...
...
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