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
13a67f62
Commit
13a67f62
authored
Feb 15, 2017
by
Dominik Hebeler
Browse files
Einige Dinge bei den Fetchern repariert
parent
e0393b87
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/Jobs/Search.php
View file @
13a67f62
...
...
@@ -89,7 +89,9 @@ class Search implements ShouldQueue
}
$bodySize
=
strlen
(
$body
);
}
else
{
}
elseif
(
isset
(
$headers
[
"connection"
])
&&
strtolower
(
$headers
[
"connection"
])
===
"close"
)
{
$body
=
$this
->
readUntilClose
();
}
else
{
exit
;
}
}
else
{
...
...
@@ -103,6 +105,20 @@ class Search implements ShouldQueue
Redis
::
hset
(
'search.'
.
$this
->
hash
,
$this
->
name
,
$body
);
Redis
::
expire
(
'search.'
.
$this
->
hash
,
5
);
}
private
function
readUntilClose
()
{
$data
=
''
;
stream_set_blocking
(
$this
->
fp
,
1
);
while
(
!
feof
(
$this
->
fp
))
{
$data
.
=
fgets
(
$this
->
fp
,
8192
);
}
# Bei dieser Funktion unterstützt der Host kein Keep-Alive:
# Wir beenden die Verbindung:
fclose
(
$this
->
fp
);
Redis
::
del
(
$this
->
host
.
"."
.
$this
->
socketNumber
);
return
$data
;
}
private
function
readBody
(
$length
)
{
...
...
@@ -228,7 +244,7 @@ class Search implements ShouldQueue
$time
=
microtime
(
true
);
while
(
true
)
{
$timeElapsed
=
microtime
(
true
)
-
$time
;
if
(
$timeElapsed
>
0.5
)
{
if
(
$timeElapsed
>
1.0
)
{
# Irgendwas ist mit unserem Socket passiert. Wir brauchen einen neuen:
if
(
$this
->
fp
&&
is_resource
(
$this
->
fp
))
{
fclose
(
$this
->
fp
);
...
...
@@ -238,7 +254,7 @@ class Search implements ShouldQueue
$this
->
fp
=
$this
->
getFreeSocket
();
$sent
=
0
;
$string
=
$out
;
break
;
continue
;
}
try
{
$tmp
=
fwrite
(
$this
->
fp
,
$string
);
...
...
@@ -304,7 +320,8 @@ class Search implements ShouldQueue
if
(
$this
->
fp
&&
is_resource
(
$this
->
fp
))
{
fclose
(
$fp
);
}
$this
->
socketNumber
=
null
;
Redis
::
del
(
$this
->
host
.
".
$counter
"
);
continue
;
}
break
;
...
...
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