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
23d10c3e
Commit
23d10c3e
authored
May 05, 2017
by
Dominik Hebeler
Browse files
Fetcher erhöhen ihre Anzahl nicht mehr selbstständig
parent
1cecd9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Jobs/Searcher.php
View file @
23d10c3e
...
...
@@ -46,6 +46,7 @@ class Searcher implements ShouldQueue
// This Searches is freshly called so we need to initialize the curl handle $ch
$this
->
ch
=
$this
->
initCurlHandle
();
$this
->
counter
=
0
;
// Counts the number of answered jobs
$lastJob
=
microtime
(
true
);
while
(
true
){
// Update the expire
Redis
::
expire
(
$this
->
name
,
5
);
...
...
@@ -59,15 +60,14 @@ class Searcher implements ShouldQueue
// The mission can be empty when blpop hit the timeout
if
(
empty
(
$mission
)){
// In that case it should be safe to simply exit this job
break
;
if
(((
microtime
(
true
)
-
$lastJob
)
)
>
300
)
break
;
else
continue
;
}
else
{
$mission
=
$mission
[
1
];
$this
->
counter
++
;
// A running Searcher checks whether more of it are needed to properly work on the
// Queue without delay
if
(
getenv
(
"QUEUE_DRIVER"
)
!==
"sync"
&&
intval
(
Redis
::
llen
(
$this
->
name
.
".queue"
))
>
1
){
$this
->
dispatch
(
new
Searcher
(
$this
->
name
));
}
$lastJob
=
microtime
(
true
);
}
// The mission is a String which can be divided to retrieve two informations:
...
...
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