sidekiq-merger 0.0.7 → 0.0.8

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: 764a83e3da41cbfaa54d2d8a0abbdcddcb42c289
4
- data.tar.gz: 40793d538fcd693873fb53aa657cbbbb82ad20a8
3
+ metadata.gz: 60636bc150095c22b100fdbbeeb75dd9e9ed77de
4
+ data.tar.gz: 8a889756673e47f928c96204210a57ee39ec8e5f
5
5
  SHA512:
6
- metadata.gz: e43782390e487179771cce40af1edefb40f493236629147fcdc44a595ae35d739a35d5c2aa2eca007975a19e69df9f0e56344f21f8a426cedccd617fbb029ad0
7
- data.tar.gz: 9e34d46fea2b98e272f29d68f0e554d9f9c93299156fc7d986a9e29f54a7464949a270e8ae8613319e0c9a5ef6cd7708f9e7a15154913c460baa8b53bf6641a1
6
+ metadata.gz: 7a166d4979d485fcf98b962859f1f550b1e9966f2243de3d1ba51f82e955c4fd95b54210f8b0506c90f9d05c74f68a828eff64324a43c3a0e6a8eeb80096bef5
7
+ data.tar.gz: 6289d83637fcc81e87b35e4d01d671fb0d26114253d65b804cabe8cf2b029c3b91a4436d921240d8abad6a84a50074cb3bdd8ef7cbe1e5279f0ab3ea16719ff0
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [![Coverage Status][cov-image]][cov-link]
7
7
  [![Code Climate][gpa-image]][gpa-link]
8
8
 
9
- Merge sidekiq jobs occurring before the execution time. Inspired by [sidekiq-grouping](https://github.com/gzigzigzeo/sidekiq-grouping).
9
+ Merge [sidekiq](http://sidekiq.org/) jobs occurring before the execution times. Inspired by [sidekiq-grouping](https://github.com/gzigzigzeo/sidekiq-grouping).
10
10
 
11
11
  ## Installation
12
12
 
@@ -23,10 +23,10 @@
23
23
  </div>
24
24
  <h3>UniqueWorker</h3>
25
25
  <div>
26
- <form action="/some_worker/perform_in" method="post" style="display: inline-block;">
26
+ <form action="/unique_worker/perform_in" method="post" style="display: inline-block;">
27
27
  <input type="submit" name="perform_in" value="perform_in">
28
28
  </form>
29
- <form action="/some_worker/perform_in" method="post" style="display: inline-block;">
29
+ <form action="/unique_worker/perform_in" method="post" style="display: inline-block;">
30
30
  <input type="submit" name="perform_async" value="perform_async">
31
31
  </form>
32
32
  </div>
@@ -12,4 +12,7 @@ Sidekiq.configure_server do |config|
12
12
  end
13
13
  end
14
14
 
15
- Sidekiq::Merger.start! if Sidekiq.server?
15
+ if Sidekiq.server?
16
+ task = Sidekiq::Merger.create_task
17
+ task.execute
18
+ end
@@ -12,7 +12,7 @@ module Sidekiq::Merger
12
12
  class << self
13
13
  attr_accessor :logger
14
14
 
15
- def start!
15
+ def create_task
16
16
  interval = Sidekiq::Merger::Config.poll_interval
17
17
  observer = Sidekiq::Merger::LoggingObserver.new(logger)
18
18
  flusher = Sidekiq::Merger::Flusher.new(logger)
@@ -20,10 +20,7 @@ module Sidekiq::Merger
20
20
  execution_interval: interval
21
21
  ) { flusher.flush }
22
22
  task.add_observer(observer)
23
- logger.info(
24
- "[#{Sidekiq::Merger::LOGGER_TAG}] Started polling merges every #{interval} seconds"
25
- )
26
- task.execute
23
+ task
27
24
  end
28
25
  end
29
26
 
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Merger
3
- VERSION = "0.0.7".freeze
3
+ VERSION = "0.0.8".freeze
4
4
  end
5
5
  end
@@ -4,19 +4,19 @@ module Sidekiq::Merger::Web
4
4
  VIEWS = File.expand_path("views", File.dirname(__FILE__))
5
5
 
6
6
  def self.registered(app)
7
- app.get "/merger" do
7
+ app.get "/merges" do
8
8
  @merges = Sidekiq::Merger::Merge.all
9
9
  erb File.read(File.join(VIEWS, "index.erb")), locals: { view_path: VIEWS }
10
10
  end
11
11
 
12
- app.post "/merger/:full_merge_key/delete" do
12
+ app.post "/merges/:full_merge_key/delete" do
13
13
  full_merge_key = URI.decode_www_form_component params[:full_merge_key]
14
14
  merge = Sidekiq::Merger::Merge.initialize_with_full_merge_key(full_merge_key)
15
15
  merge.delete_all
16
- redirect "#{root_path}/merger"
16
+ redirect "#{root_path}/merges"
17
17
  end
18
18
  end
19
19
  end
20
20
 
21
21
  Sidekiq::Web.register(Sidekiq::Merger::Web)
22
- Sidekiq::Web.tabs["Merger"] = "merger"
22
+ Sidekiq::Web.tabs["Merges"] = "merges"
Binary file
@@ -2,6 +2,13 @@ require "spec_helper"
2
2
 
3
3
  describe Sidekiq::Merger do
4
4
  it "has a version number" do
5
- expect(Sidekiq::Merger::VERSION).not_to be nil
5
+ expect(described_class::VERSION).not_to be nil
6
+ end
7
+ describe "#create_task" do
8
+ it "starts a monitoring task" do
9
+ task = described_class.create_task
10
+ expect(task).to be_a Concurrent::TimerTask
11
+ task.shutdown
12
+ end
6
13
  end
7
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-merger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - dtaniwaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake