cobweb 1.0.17 → 1.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.textile +1 -1
- data/lib/cobweb_version.rb +1 -1
- data/lib/crawl_finished_worker.rb +2 -3
- data/lib/crawl_process_worker.rb +1 -2
- data/lib/crawl_worker.rb +1 -3
- data/lib/sidekiq/cobweb_helper.rb +8 -0
- data/spec/cobweb/crawl_worker_spec.rb +18 -15
- data/spec/spec_helper.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTg3ODFiMWE1MmZlYWFjYzZiZjIzZjQ1NmFjZmJmMWU1MDVjZTc5Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGU4NmFiYTJlNmZlODRiMjRmNTkzZjMwOWQyMzEyZjU4OGQzMWUxMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDVmN2MwYzBiMjQ1N2E2YjBmYmM0ZTk5ZWJjMGVkN2VmMDM4ODhkNTQ0OTIx
|
10
|
+
ZTg4YzMzMWE0OTY2ZjgyNWRiNzZlZjgyZDlkM2Y4MTQ2OTVmZTg5Zjc1NTA1
|
11
|
+
MTZhYzc2ZmYwNmM2ODRlMmViODljMGFjODYwNTY5OThlNjY2M2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2M2YzU4ZTE5YzkxMWVmNmJiNTQ5OWFhNDExZGUwNzkxMGEzY2IyYTFmYTJl
|
14
|
+
YTE0OWI2ZmZhN2I0ZjA2YjU4NWFmNmUwMjY5ZDM4YWQ3ZmJkZmViNzRlNWMw
|
15
|
+
ZWMzNjIwNDkxNDk0NmMxOTE3NzljMGQ5MjlmYzgyODc3ZWQ2ZTY=
|
data/README.textile
CHANGED
data/lib/cobweb_version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/sidekiq/cobweb_helper')
|
3
3
|
|
4
4
|
# If your client is single-threaded, we just need a single connection in our Redis connection pool
|
@@ -15,8 +15,7 @@ class CrawlFinishedWorker
|
|
15
15
|
|
16
16
|
include Sidekiq::Worker
|
17
17
|
|
18
|
-
sidekiq_options queue: "crawl_finished_worker"
|
19
|
-
|
18
|
+
sidekiq_options queue: "crawl_finished_worker" if SIDEKIQ_INSTALLED
|
20
19
|
|
21
20
|
def perform(statistics)
|
22
21
|
puts "Dummy Finished Job"
|
data/lib/crawl_process_worker.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
|
2
|
-
require 'sidekiq'
|
3
2
|
require File.expand_path(File.dirname(__FILE__) + '/sidekiq/cobweb_helper')
|
4
3
|
|
5
4
|
# If your client is single-threaded, we just need a single connection in our Redis connection pool
|
@@ -16,7 +15,7 @@ class CrawlProcessWorker
|
|
16
15
|
|
17
16
|
include Sidekiq::Worker
|
18
17
|
|
19
|
-
sidekiq_options queue: "crawl_process_worker"
|
18
|
+
sidekiq_options queue: "crawl_process_worker" if SIDEKIQ_INSTALLED
|
20
19
|
|
21
20
|
def perform(content)
|
22
21
|
content = HashUtil.deep_symbolize_keys(content)
|
data/lib/crawl_worker.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'sidekiq'
|
2
1
|
require File.expand_path(File.dirname(__FILE__) + '/cobweb')
|
3
2
|
require File.expand_path(File.dirname(__FILE__) + '/sidekiq/cobweb_helper')
|
4
3
|
|
@@ -14,8 +13,7 @@ require File.expand_path(File.dirname(__FILE__) + '/sidekiq/cobweb_helper')
|
|
14
13
|
|
15
14
|
class CrawlWorker
|
16
15
|
include Sidekiq::Worker
|
17
|
-
sidekiq_options queue
|
18
|
-
sidekiq_options retry: false
|
16
|
+
sidekiq_options :queue => "crawl_worker", :retry => false if SIDEKIQ_INSTALLED
|
19
17
|
|
20
18
|
def perform(content_request)
|
21
19
|
# setup the crawl class to manage the crawl of this object
|
@@ -4,25 +4,28 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
4
4
|
describe CrawlWorker, :local_only => true do
|
5
5
|
|
6
6
|
before(:all) do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
|
8
|
+
if SIDEKIQ_INSTALLED
|
9
|
+
#store all existing resque process ids so we don't kill them afterwards
|
10
|
+
@existing_processes = `ps aux | grep sidekiq | grep -v grep | awk '{print $2}'`.split("\n")
|
11
|
+
puts @existing_processes
|
12
|
+
@existing_processes.should be_empty
|
13
|
+
|
14
|
+
# START WORKERS ONLY FOR CRAWL QUEUE SO WE CAN COUNT ENQUEUED PROCESS AND FINISH QUEUES
|
15
|
+
puts "Starting Workers... Please Wait..."
|
16
|
+
`mkdir log`
|
17
|
+
`rm -rf output.log`
|
18
|
+
io = IO.popen("nohup sidekiq -r ./lib/crawl_worker.rb -q crawl_worker > ./log/output.log &")
|
19
|
+
puts "Workers Started."
|
20
|
+
end
|
19
21
|
end
|
20
22
|
|
21
23
|
before(:each) do
|
24
|
+
pending("Sidkiq not installed") unless SIDEKIQ_INSTALLED
|
22
25
|
@base_url = "http://localhost:3532/"
|
23
26
|
@base_page_count = 77
|
24
27
|
|
25
|
-
|
28
|
+
clear_sidekiq_queues
|
26
29
|
end
|
27
30
|
|
28
31
|
describe "with no crawl limit" do
|
@@ -198,7 +201,7 @@ describe CrawlWorker, :local_only => true do
|
|
198
201
|
command = "kill #{(@all_processes - @existing_processes).join(" ")}"
|
199
202
|
IO.popen(command)
|
200
203
|
end
|
201
|
-
|
204
|
+
clear_sidekiq_queues
|
202
205
|
end
|
203
206
|
|
204
207
|
end
|
@@ -234,7 +237,7 @@ def running?(crawl_id)
|
|
234
237
|
result
|
235
238
|
end
|
236
239
|
|
237
|
-
def
|
240
|
+
def clear_sidekiq_queues
|
238
241
|
Sidekiq.redis do |conn|
|
239
242
|
conn.smembers("queues").each do |queue_name|
|
240
243
|
conn.del("queue:#{queue_name}")
|
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec/samples/sample_serve
|
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/../spec/http_stubs')
|
5
5
|
require 'mock_redis'
|
6
6
|
require 'thin' if ENV["TRAVIS_RUBY_VERSION"].nil?
|
7
|
-
require 'sidekiq'
|
8
7
|
|
9
8
|
require 'coveralls'
|
10
9
|
Coveralls.wear!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cobweb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stewart McKee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|