bushpig 0.1.11 → 0.1.15

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
  SHA256:
3
- metadata.gz: 6e851a30d506853e4b90dc634602965ea520d0499a72edf92c5ee0cf3ea39f10
4
- data.tar.gz: ef79c0b258b38f10739dd3b6c5496afd2547401bf65586f381b700e582a5d651
3
+ metadata.gz: 1800e5fc6bc96bda845a3dd67b75be688789bc81f985365c0c8ef3da2d69af69
4
+ data.tar.gz: cd13f6a976d3b4916e30a35d5f957f21502a3d0bd314d090535f80d700caf597
5
5
  SHA512:
6
- metadata.gz: 928d495049bd4d9ab65d6255f4f8743bae42de26eb66f7d5f3ba84992536c90b27daca7693b90f6de85d58058ed8739d0a1db2fcd814f18c504049dc0cb5fa34
7
- data.tar.gz: 5708e74eff120f8b9e8488d72debe2a573ff53f1ed2b99408d80faf40d1e2e0511bce5f197e468f0efb9e84c0c85f2906f439f726b118a6ad9fa489a2d70e78b
6
+ metadata.gz: fb9dd90b526dfc385938dba40276af91bb8254575e5cc39b95fcdc8ba6ce548c767a114a329b6496d745c49ea8e8c57b781b327777dfa8ce050246d5890979c8
7
+ data.tar.gz: 28929d34ce816df4dcdbf9e7bd626bfb427464e35070a758eee782117bf17a30750242a328a3bf211cb50c57aaa42959e3ff70949ad5b4d9d1f99867c6d8a305
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bushpig (0.1.11)
4
+ bushpig (0.1.15)
5
5
  connection_pool (~> 2.2)
6
6
  json (>= 1.8)
7
7
  redis (~> 3.3)
@@ -16,15 +16,23 @@ GEM
16
16
  coderay (1.1.3)
17
17
  connection_pool (2.2.5)
18
18
  e2mmap (0.1.0)
19
+ io-wait (0.1.0)
19
20
  jaro_winkler (1.5.4)
20
- json (2.1.0)
21
+ json (2.5.1)
21
22
  kramdown (2.3.1)
22
23
  rexml
23
24
  kramdown-parser-gfm (1.1.0)
24
25
  kramdown (~> 2.0)
25
26
  method_source (1.0.0)
26
- mini_portile2 (2.5.1)
27
- nokogiri (1.11.3)
27
+ mini_portile2 (2.5.2)
28
+ net-ftp (~> 0.1)
29
+ net-ftp (0.1.2)
30
+ net-protocol
31
+ time
32
+ net-protocol (0.1.1)
33
+ io-wait
34
+ timeout
35
+ nokogiri (1.11.6)
28
36
  mini_portile2 (~> 2.5.0)
29
37
  racc (~> 1.4)
30
38
  parallel (1.20.1)
@@ -41,7 +49,7 @@ GEM
41
49
  reverse_markdown (2.0.0)
42
50
  nokogiri
43
51
  rexml (3.2.5)
44
- rubocop (1.14.0)
52
+ rubocop (1.15.0)
45
53
  parallel (~> 1.10)
46
54
  parser (>= 3.0.0.0)
47
55
  rainbow (>= 2.2.2, < 4.0)
@@ -50,10 +58,10 @@ GEM
50
58
  rubocop-ast (>= 1.5.0, < 2.0)
51
59
  ruby-progressbar (~> 1.7)
52
60
  unicode-display_width (>= 1.4.0, < 3.0)
53
- rubocop-ast (1.5.0)
61
+ rubocop-ast (1.7.0)
54
62
  parser (>= 3.0.1.1)
55
63
  ruby-progressbar (1.11.0)
56
- solargraph (0.40.4)
64
+ solargraph (0.41.0)
57
65
  backport (~> 1.1)
58
66
  benchmark
59
67
  bundler (>= 1.17.2)
@@ -69,6 +77,8 @@ GEM
69
77
  yard (~> 0.9, >= 0.9.24)
70
78
  thor (1.1.0)
71
79
  tilt (2.0.10)
80
+ time (0.1.0)
81
+ timeout (0.1.1)
72
82
  unicode-display_width (2.0.0)
73
83
  yard (0.9.26)
74
84
 
@@ -84,4 +94,4 @@ DEPENDENCIES
84
94
  solargraph
85
95
 
86
96
  BUNDLED WITH
87
- 2.1.4
97
+ 2.2.20
data/gemset.nix CHANGED
@@ -32,161 +32,12 @@
32
32
  bushpig = {
33
33
  dependencies = ["connection_pool" "json" "redis" "thor"];
34
34
  groups = ["default"];
35
- platforms = [{
36
- engine = "maglev";
37
- } {
38
- engine = "maglev";
39
- } {
40
- engine = "maglev";
41
- version = "1.8";
42
- } {
43
- engine = "maglev";
44
- version = "1.8";
45
- } {
46
- engine = "maglev";
47
- version = "1.9";
48
- } {
49
- engine = "maglev";
50
- version = "1.9";
51
- } {
52
- engine = "maglev";
53
- version = "2.0";
54
- } {
55
- engine = "maglev";
56
- version = "2.0";
57
- } {
58
- engine = "maglev";
59
- version = "2.1";
60
- } {
61
- engine = "maglev";
62
- version = "2.1";
63
- } {
64
- engine = "maglev";
65
- version = "2.2";
66
- } {
67
- engine = "maglev";
68
- version = "2.2";
69
- } {
70
- engine = "maglev";
71
- version = "2.3";
72
- } {
73
- engine = "maglev";
74
- version = "2.3";
75
- } {
76
- engine = "maglev";
77
- version = "2.4";
78
- } {
79
- engine = "maglev";
80
- version = "2.4";
81
- } {
82
- engine = "maglev";
83
- version = "2.5";
84
- } {
85
- engine = "maglev";
86
- version = "2.5";
87
- } {
88
- engine = "maglev";
89
- version = "2.6";
90
- } {
91
- engine = "maglev";
92
- version = "2.6";
93
- } {
94
- engine = "rbx";
95
- } {
96
- engine = "rbx";
97
- } {
98
- engine = "rbx";
99
- version = "1.8";
100
- } {
101
- engine = "rbx";
102
- version = "1.9";
103
- } {
104
- engine = "rbx";
105
- version = "2.0";
106
- } {
107
- engine = "rbx";
108
- version = "2.1";
109
- } {
110
- engine = "rbx";
111
- version = "2.2";
112
- } {
113
- engine = "rbx";
114
- version = "2.3";
115
- } {
116
- engine = "rbx";
117
- version = "2.4";
118
- } {
119
- engine = "rbx";
120
- version = "2.5";
121
- } {
122
- engine = "rbx";
123
- version = "2.6";
124
- } {
125
- engine = "ruby";
126
- } {
127
- engine = "ruby";
128
- } {
129
- engine = "ruby";
130
- } {
131
- engine = "ruby";
132
- version = "1.8";
133
- } {
134
- engine = "ruby";
135
- version = "1.8";
136
- } {
137
- engine = "ruby";
138
- version = "1.9";
139
- } {
140
- engine = "ruby";
141
- version = "1.9";
142
- } {
143
- engine = "ruby";
144
- version = "2.0";
145
- } {
146
- engine = "ruby";
147
- version = "2.0";
148
- } {
149
- engine = "ruby";
150
- version = "2.1";
151
- } {
152
- engine = "ruby";
153
- version = "2.1";
154
- } {
155
- engine = "ruby";
156
- version = "2.2";
157
- } {
158
- engine = "ruby";
159
- version = "2.2";
160
- } {
161
- engine = "ruby";
162
- version = "2.3";
163
- } {
164
- engine = "ruby";
165
- version = "2.3";
166
- } {
167
- engine = "ruby";
168
- version = "2.4";
169
- } {
170
- engine = "ruby";
171
- version = "2.4";
172
- } {
173
- engine = "ruby";
174
- version = "2.5";
175
- } {
176
- engine = "ruby";
177
- version = "2.5";
178
- } {
179
- engine = "ruby";
180
- version = "2.6";
181
- } {
182
- engine = "ruby";
183
- version = "2.6";
184
- }];
35
+ platforms = [];
185
36
  source = {
186
37
  path = ./.;
187
38
  type = "path";
188
39
  };
189
- version = "0.1.11";
40
+ version = "0.1.15";
190
41
  };
191
42
  coderay = {
192
43
  groups = ["default" "development"];
@@ -367,6 +218,16 @@
367
218
  };
368
219
  version = "0.1.0";
369
220
  };
221
+ io-wait = {
222
+ groups = ["default" "development"];
223
+ platforms = [];
224
+ source = {
225
+ remotes = ["https://rubygems.org"];
226
+ sha256 = "11zpcigndc11fkr2s6659d7nh1hj09zpmxlyqp9yq1mx76038s6w";
227
+ type = "gem";
228
+ };
229
+ version = "0.1.0";
230
+ };
370
231
  jaro_winkler = {
371
232
  groups = ["default" "development"];
372
233
  platforms = [];
@@ -531,10 +392,10 @@
531
392
  }];
532
393
  source = {
533
394
  remotes = ["https://rubygems.org"];
534
- sha256 = "01v6jjpvh3gnq6sgllpfqahlgxzj50ailwhj9b3cd20hi2dx0vxp";
395
+ sha256 = "0lrirj0gw420kw71bjjlqkqhqbrplla61gbv1jzgsz6bv90qr3ci";
535
396
  type = "gem";
536
397
  };
537
- version = "2.1.0";
398
+ version = "2.5.1";
538
399
  };
539
400
  kramdown = {
540
401
  dependencies = ["rexml"];
@@ -569,14 +430,37 @@
569
430
  version = "1.0.0";
570
431
  };
571
432
  mini_portile2 = {
433
+ dependencies = ["net-ftp"];
572
434
  groups = ["default" "development"];
573
435
  platforms = [];
574
436
  source = {
575
437
  remotes = ["https://rubygems.org"];
576
- sha256 = "0xg1x4708a4pn2wk8qs2d8kfzzdyv9kjjachg2f1phsx62ap2rx2";
438
+ sha256 = "0a2y04km3aciybk12yimkqn0ycrzy23iygl116n7addix9xdii3s";
577
439
  type = "gem";
578
440
  };
579
- version = "2.5.1";
441
+ version = "2.5.2";
442
+ };
443
+ net-ftp = {
444
+ dependencies = ["net-protocol" "time"];
445
+ groups = ["default" "development"];
446
+ platforms = [];
447
+ source = {
448
+ remotes = ["https://rubygems.org"];
449
+ sha256 = "1gx09b00k454fgn7q41r9xs5j5v9qj8xhfxnm650cns1ywcmzkil";
450
+ type = "gem";
451
+ };
452
+ version = "0.1.2";
453
+ };
454
+ net-protocol = {
455
+ dependencies = ["io-wait" "timeout"];
456
+ groups = ["default" "development"];
457
+ platforms = [];
458
+ source = {
459
+ remotes = ["https://rubygems.org"];
460
+ sha256 = "1ivxcqwgnrqbp2y0zpxz64in9a2cx9q9b0fxb630c51a1jaq63yz";
461
+ type = "gem";
462
+ };
463
+ version = "0.1.1";
580
464
  };
581
465
  nokogiri = {
582
466
  dependencies = ["mini_portile2" "racc"];
@@ -584,10 +468,10 @@
584
468
  platforms = [];
585
469
  source = {
586
470
  remotes = ["https://rubygems.org"];
587
- sha256 = "19d78mdg2lbz9jb4ph6nk783c9jbsdm8rnllwhga6pd53xffp6x0";
471
+ sha256 = "1z4x366icbl9w13pk50vxx5kywlksvhxqxrpv8f5xpjxfl3jl64z";
588
472
  type = "gem";
589
473
  };
590
- version = "1.11.3";
474
+ version = "1.11.6";
591
475
  };
592
476
  parallel = {
593
477
  groups = ["default" "development"];
@@ -847,10 +731,10 @@
847
731
  platforms = [];
848
732
  source = {
849
733
  remotes = ["https://rubygems.org"];
850
- sha256 = "0chjr6i0g7frbp7dhi4d83ppf7akkdaw7mcgcwbxd6a9mairafpp";
734
+ sha256 = "1xhay8qn3p5f3g6x8i6zh372zk5w2wjrv9dksysxal1r5brkly1w";
851
735
  type = "gem";
852
736
  };
853
- version = "1.14.0";
737
+ version = "1.15.0";
854
738
  };
855
739
  rubocop-ast = {
856
740
  dependencies = ["parser"];
@@ -858,10 +742,10 @@
858
742
  platforms = [];
859
743
  source = {
860
744
  remotes = ["https://rubygems.org"];
861
- sha256 = "0hx4im1a2qpiwipvsl3fma358ixjp4h0mhj56ichq15xrq709qlf";
745
+ sha256 = "1hnrfy928mwpa0ippqs4s8xwghwwp5h853naphgqxcd53l33chlv";
862
746
  type = "gem";
863
747
  };
864
- version = "1.5.0";
748
+ version = "1.7.0";
865
749
  };
866
750
  ruby-progressbar = {
867
751
  groups = ["default" "development"];
@@ -879,10 +763,10 @@
879
763
  platforms = [];
880
764
  source = {
881
765
  remotes = ["https://rubygems.org"];
882
- sha256 = "0xrad7amwf3nmdbif566qprk6xvwydxwz0s7arnzpvr01anc9gcl";
766
+ sha256 = "18daiaffwniprkfn9xq0njzqr8n37kw2605608njz2gz02m7b1rj";
883
767
  type = "gem";
884
768
  };
885
- version = "0.40.4";
769
+ version = "0.41.0";
886
770
  };
887
771
  thor = {
888
772
  groups = ["default"];
@@ -1053,6 +937,26 @@
1053
937
  };
1054
938
  version = "2.0.10";
1055
939
  };
940
+ time = {
941
+ groups = ["default" "development"];
942
+ platforms = [];
943
+ source = {
944
+ remotes = ["https://rubygems.org"];
945
+ sha256 = "1ayfwm8b0c6n0z34vwfpmy83lf1gd0mq7jbybzarkqp2ylmdlzvy";
946
+ type = "gem";
947
+ };
948
+ version = "0.1.0";
949
+ };
950
+ timeout = {
951
+ groups = ["default" "development"];
952
+ platforms = [];
953
+ source = {
954
+ remotes = ["https://rubygems.org"];
955
+ sha256 = "0lr1pp2hh6np1x9milzs4rim9sfpsb4izhs4dd5q5nnhkcwx8i63";
956
+ type = "gem";
957
+ };
958
+ version = "0.1.1";
959
+ };
1056
960
  unicode-display_width = {
1057
961
  groups = ["default" "development"];
1058
962
  platforms = [];
@@ -19,11 +19,16 @@ module Bushpig
19
19
  end
20
20
 
21
21
  def submit(queue, job, score: default_score, ttl: default_ttl)
22
- modified = @callback.call(job)
23
- redis_pool.with do |conn|
24
- conn.set(Bushpig.job_key(modified.job_key), modified.job_payload, ex: ttl)
25
- conn.zadd(Bushpig.queue_key(queue), score, modified.job_key)
26
- end
22
+ new = if Bushpig.testing
23
+ job.handle
24
+ true
25
+ else
26
+ redis_pool.with do |conn|
27
+ conn.set(Bushpig.job_key(job.job_key), job.job_payload, ex: ttl)
28
+ conn.zadd(Bushpig.queue_key(queue), score, job.job_key)
29
+ end
30
+ end
31
+ @callback&.call(job, new)
27
32
  end
28
33
  end
29
34
  end
@@ -37,7 +37,10 @@ module Bushpig
37
37
 
38
38
  until @done
39
39
  job = fetch(queue)
40
- next if job.nil?
40
+ if job.nil?
41
+ ActiveRecord::Base.clear_active_connections!
42
+ next
43
+ end
41
44
 
42
45
  handle(job)
43
46
  complete(job)
@@ -59,6 +62,7 @@ module Bushpig
59
62
  elapsed = finished - started
60
63
  puts "Job raised exception: jid-#{job.job_id} #{elapsed} seconds: #{e}"
61
64
  notify_exception(job, e)
65
+ ActiveRecord::Base.clear_active_connections!
62
66
  end
63
67
 
64
68
  def honeybadger
@@ -0,0 +1,14 @@
1
+
2
+ # frozen_string_literal: true
3
+
4
+ module Bushpig
5
+ module Testing
6
+ def self.inline!(&block)
7
+ old = Bushpig.testing
8
+ Bushpig.testing = true
9
+ result = block.call
10
+ Bushpig.testing = old
11
+ result
12
+ end
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bushpig
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.15'
5
5
  end
data/lib/bushpig.rb CHANGED
@@ -6,6 +6,7 @@ require 'bushpig/redis_pool'
6
6
  require 'bushpig/job'
7
7
  require 'bushpig/client'
8
8
  require 'bushpig/server'
9
+ require 'bushpig/testing'
9
10
 
10
11
  module Bushpig
11
12
  NAME = 'Bushpig'
@@ -31,6 +32,14 @@ module Bushpig
31
32
  @server = server
32
33
  end
33
34
 
35
+ def self.testing
36
+ @testing ||= false
37
+ end
38
+
39
+ def self.testing=(testing)
40
+ @testing = testing
41
+ end
42
+
34
43
  def self.configure_server
35
44
  yield self if server?
36
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bushpig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun Sharples
@@ -162,6 +162,7 @@ files:
162
162
  - lib/bushpig/job.rb
163
163
  - lib/bushpig/redis_pool.rb
164
164
  - lib/bushpig/server.rb
165
+ - lib/bushpig/testing.rb
165
166
  - lib/bushpig/version.rb
166
167
  - shell.nix
167
168
  homepage: https://github.com/mpowered/bushpig
@@ -190,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
191
  - !ruby/object:Gem::Version
191
192
  version: '0'
192
193
  requirements: []
193
- rubygems_version: 3.1.3
194
+ rubygems_version: 3.2.26
194
195
  signing_key:
195
196
  specification_version: 4
196
197
  summary: Simple job system.