Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
MetaGer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
open-source
MetaGer
Commits
2f3aaae4
Commit
2f3aaae4
authored
Nov 19, 2019
by
Dominik Hebeler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
workers now accept a socks5 configuration
parent
2f772526
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
.env.example
.env.example
+1
-1
app/Jobs/Searcher.php
app/Jobs/Searcher.php
+13
-1
phpunit.xml
phpunit.xml
+1
-1
No files found.
.env.example
View file @
2f3aaae4
...
...
@@ -7,7 +7,7 @@ APP_URL=http://localhost
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_
DRIVER
=sync
QUEUE_
CONNECTION
=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
...
...
app/Jobs/Searcher.php
View file @
2f3aaae4
...
...
@@ -13,6 +13,7 @@ class Searcher implements ShouldQueue
use
InteractsWithQueue
,
Queueable
,
SerializesModels
;
protected
$name
,
$ch
,
$pid
,
$counter
,
$lastTime
,
$connectionInfo
,
$user
,
$password
,
$headers
;
protected
$proxyhost
,
$proxyuser
,
$proxypassword
;
# Each Searcher will shutdown after a specified time(s) or number of requests
protected
$MAX_REQUESTS
=
100
;
# This value should always be below the retry_after value in config/queue.php
...
...
@@ -41,6 +42,10 @@ class Searcher implements ShouldQueue
$this
->
user
=
$user
;
$this
->
password
=
$password
;
$this
->
headers
=
$headers
;
$this
->
proxyhost
=
env
(
"PROXY_HOST"
,
""
);
$this
->
proxyport
=
env
(
"PROXY_PORT"
,
""
);
$this
->
proxyuser
=
env
(
"PROXY_USER"
,
""
);
$this
->
proxypassword
=
env
(
"PROXY_PASSWORD"
,
""
);
// Submit this worker to the Redis System
Redis
::
expire
(
$this
->
name
,
5
);
}
...
...
@@ -123,7 +128,7 @@ class Searcher implements ShouldQueue
* When a search engine needs more time to produce search results than the timeout of the MetaGer process, we won't even bother of spawning
* more and more Searchers because they would just block free worker processes from serving the important engines which will give results in time.
**/
if
(
$this
->
counter
===
3
||
getenv
(
"QUEUE_
DRIVER
"
)
===
"sync"
)
{
if
(
$this
->
counter
===
3
||
getenv
(
"QUEUE_
CONNECTION
"
)
===
"sync"
)
{
# If the MetaGer process waits longer for the results than this Fetcher will probably need to fetch
# Or if this engine is in the array of important engines which we will always try to serve
Redis
::
set
(
$this
->
name
,
"running"
);
...
...
@@ -206,6 +211,13 @@ class Searcher implements ShouldQueue
CURLOPT_TIMEOUT
=>
10
,
));
if
(
!
empty
(
$this
->
proxyhost
)
&&
!
empty
(
$this
->
proxyport
)
&&
!
empty
(
$this
->
proxyuser
)
&&
!
empty
(
$this
->
proxypassword
))
{
curl_setopt
(
CURLOPT_PROXY
,
$this
->
proxyhost
);
curl_setopt
(
CURLOPT_PROXYUSERPWD
,
$this
->
proxyuser
.
":"
.
$this
->
proxypassword
);
curl_setopt
(
CURLOPT_PROXYPORT
,
$this
->
proxyport
);
curl_setopt
(
CURLOPT_PROXYTYPE
,
CURLPROXY_SOCKS5
);
}
if
(
$this
->
user
!==
null
&&
$this
->
password
!==
null
)
{
curl_setopt
(
$ch
,
CURLOPT_USERPWD
,
$this
->
user
.
":"
.
$this
->
password
);
}
...
...
phpunit.xml
View file @
2f3aaae4
...
...
@@ -22,6 +22,6 @@
<env
name=
"APP_ENV"
value=
"testing"
/>
<env
name=
"CACHE_DRIVER"
value=
"array"
/>
<env
name=
"SESSION_DRIVER"
value=
"array"
/>
<env
name=
"QUEUE_
DRIVER
"
value=
"sync"
/>
<env
name=
"QUEUE_
CONNECTION
"
value=
"sync"
/>
</php>
</phpunit>
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