sidekiq-merger 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/views/index.erb +2 -2
- data/lib/sidekiq-merger.rb +4 -1
- data/lib/sidekiq/merger.rb +2 -5
- data/lib/sidekiq/merger/version.rb +1 -1
- data/lib/sidekiq/merger/web.rb +4 -4
- data/misc/web_ui.png +0 -0
- data/spec/sidekiq/merger_spec.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60636bc150095c22b100fdbbeeb75dd9e9ed77de
|
4
|
+
data.tar.gz: 8a889756673e47f928c96204210a57ee39ec8e5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
|
data/app/views/index.erb
CHANGED
@@ -23,10 +23,10 @@
|
|
23
23
|
</div>
|
24
24
|
<h3>UniqueWorker</h3>
|
25
25
|
<div>
|
26
|
-
<form action="/
|
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="/
|
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>
|
data/lib/sidekiq-merger.rb
CHANGED
data/lib/sidekiq/merger.rb
CHANGED
@@ -12,7 +12,7 @@ module Sidekiq::Merger
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :logger
|
14
14
|
|
15
|
-
def
|
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
|
-
|
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
|
|
data/lib/sidekiq/merger/web.rb
CHANGED
@@ -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 "/
|
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 "/
|
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}/
|
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["
|
22
|
+
Sidekiq::Web.tabs["Merges"] = "merges"
|
data/misc/web_ui.png
CHANGED
Binary file
|
data/spec/sidekiq/merger_spec.rb
CHANGED
@@ -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(
|
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.
|
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
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|