logstash-input-yasuri 5.0.4 → 5.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e24cb2f310e23e273c52bc23bc984555bf682f17
4
- data.tar.gz: 13ab2bbbd94c68087ec78d2bbba26a8f423b1b47
3
+ metadata.gz: e54ac85b6929fa390d3ab2ad1b51376b07ed9df7
4
+ data.tar.gz: 3c04d6f8de0899b3b8501bd5aec04a4555a6c796
5
5
  SHA512:
6
- metadata.gz: 97a3340efb2b5d13fc2fc76ef39d6888163f108d42ba058890e074fdb86b9ad17edc1ccca0d4e232a234466cbd71d6e82d9ed93f447a212125f0d91d5ed9c7a3
7
- data.tar.gz: fe6a775469684d7572cd8db18f9b37eb187b5a4e4faf71da11b66f49237bff496e476bb0f969801af8475915edd079350b820d9d050c44b45794a5805631fa29
6
+ metadata.gz: 95bb7e2246ddd8bef90ae0b0681fd9fa1da375c3742847cd02e7796f27c7459b7059665d06f5e0102f3763d7cae7809b5ccf23eccd57c7f11013b54203b8dc9e
7
+ data.tar.gz: b938c3e447dab1563dabae4dfa87170f8c97897d4d130fda92ef5a6cce74d876f8d3c3dab2e4f4b55349023a91920c1ec4c201f7c9137220da44cbe71f15d740
@@ -2,6 +2,7 @@
2
2
  require "logstash/inputs/base"
3
3
  require "logstash/namespace"
4
4
  require "socket" # for Socket.gethostname
5
+ require "rufus-scheduler"
5
6
  require "mechanize"
6
7
  require "yasuri"
7
8
 
@@ -26,12 +27,13 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
26
27
  # Split each results to individual events (struct or pages)
27
28
  config :split, :default => false
28
29
 
29
- config :interval, :validate => :number, :default => 60
30
+ config :cron, :validate => :string, :default => '* * * * *'
30
31
 
31
32
  public
32
33
  def register
33
34
  @host = Socket.gethostname
34
35
  @agent = Mechanize.new
36
+ @scheduler = Rufus::Scheduler.new
35
37
 
36
38
  # If given both, logstash-input-yasuri use :parse_tree.
37
39
  tree = @parse_tree || File.read(@parse_tree_path)
@@ -41,14 +43,13 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
41
43
 
42
44
  def run(queue)
43
45
  # we can abort the loop if stop? becomes true
44
- while !stop?
46
+ scheduler.cron @cron do
45
47
  # because the sleep interval can be big, when shutdown happens
46
48
  # we want to be able to abort the sleep
47
49
  # Stud.stoppable_sleep will frequently evaluate the given block
48
50
  # and abort the sleep(@interval) if the return value is true
49
51
  inner_run(queue)
50
- Stud.stoppable_sleep(@interval) { stop? }
51
- end # loop
52
+ end
52
53
  end # def run
53
54
 
54
55
  def stop
@@ -57,6 +58,7 @@ class LogStash::Inputs::Yasuri < LogStash::Inputs::Base
57
58
  # * close sockets (unblocking blocking reads/accepts)
58
59
  # * cleanup temporary files
59
60
  # * terminate spawned threads
61
+ @scheduler.shutdown
60
62
  end
61
63
 
62
64
  def inner_run(queue)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-input-yasuri'
3
- s.version = '5.0.4'
3
+ s.version = '5.0.5'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "Web scraping input plugin for logstash."
6
6
  s.description = "Web scraping input plugin for logstash."
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency 'logstash-core-plugin-api', '~> 2'
22
22
  s.add_runtime_dependency 'stud', '>= 0.0.22'
23
23
  s.add_runtime_dependency 'yasuri', '~> 1.9'
24
-
24
+ s.add_runtime_dependency 'rufus-scheduler', '>= 0'
25
25
  s.add_development_dependency 'logstash-devutils', '>= 0.0.16'
26
26
  s.add_development_dependency 'logstash-codec-plain'
27
27
  s.add_development_dependency 'fuubar', '>= 2.2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-yasuri
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - tac0x2a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-12 00:00:00.000000000 Z
11
+ date: 2016-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.9'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: rufus-scheduler
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  requirement: !ruby/object:Gem::Requirement
57
71
  requirements: