disc 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 +4 -4
- data/README.md +9 -0
- data/bin/disc +2 -5
- data/lib/disc/version.rb +1 -1
- data/lib/disc.rb +11 -11
- metadata +2 -3
- data/examples/failer.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5ee2da4bef94664480d83b714c143e5c45e3cac
|
4
|
+
data.tar.gz: 387342a78355c0cac2dc8d344ec23332a71d3841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e20e956400a9dc713f36e4aa47ff61261c9e66c0d3f2ee8f5b523d6aeecfbe498eb6d29339cbd62bd5f85f4a00a12f43986b8670e4668967fdc3a64499837e8
|
7
|
+
data.tar.gz: 1fff7b0e2f8832e3c74da9d154893765ac5f49294ba0b3167dd738c8daf1749a641584281cb2bdc872e18f280c7caccc07ca55c9bac73e0d15e3e4fde28c660e
|
data/README.md
CHANGED
@@ -108,6 +108,8 @@ for example.
|
|
108
108
|
Both the error handler function and the `disc_start` callback get the data of
|
109
109
|
the current job as a Hash, that has the following schema.
|
110
110
|
|
111
|
+
| | |
|
112
|
+
|:-------------:|:------------------------------------------------------|
|
111
113
|
| `'class'` | (String) The Job class. |
|
112
114
|
| `'arguments'` | (Array) The arguments passed to perform. |
|
113
115
|
| `'queue'` | (String) The queue from which this job was picked up. |
|
@@ -132,3 +134,10 @@ default.
|
|
132
134
|
|
133
135
|
The code is released under an MIT license. See the [LICENSE](./LICENSE) file for
|
134
136
|
more information.
|
137
|
+
|
138
|
+
## Acknowledgements
|
139
|
+
|
140
|
+
* To [@godfoca](https://github.com/godfoca) for helping me ship a quality thing and putting up with my constant whining.
|
141
|
+
* To [@antirez](https://github,com/antirez) for Redis, Disque, and his refreshing way of programming wonderful tools.
|
142
|
+
* To [@soveran](https://github.com/soveran) for pushing me to work on this and publishing gems that keep me enjoying ruby.
|
143
|
+
* To [all contributors](https://github.com/pote/disc/graphs/contributors)
|
data/bin/disc
CHANGED
@@ -9,7 +9,7 @@ Clap.run ARGV,
|
|
9
9
|
if defined?(Celluloid)
|
10
10
|
concurrency = ENV.fetch('DISC_CONCURRENCY', '25').to_i
|
11
11
|
STDOUT.puts(
|
12
|
-
"[Notice] Disc running in celluloid
|
12
|
+
"[Notice] Disc running in celluloid mode! Current DISC_CONCURRENCY is\
|
13
13
|
#{ concurrency }."
|
14
14
|
)
|
15
15
|
|
@@ -32,9 +32,6 @@ if defined?(Celluloid)
|
|
32
32
|
)
|
33
33
|
end
|
34
34
|
else
|
35
|
-
STDOUT.puts(
|
36
|
-
"[Notice] Disc running in non-threaded mode, consider requiring celluloid\
|
37
|
-
for a significant powerup!"
|
38
|
-
)
|
35
|
+
STDOUT.puts("[Notice] Disc running in non-threaded mode")
|
39
36
|
Disc::Worker.run
|
40
37
|
end
|
data/lib/disc/version.rb
CHANGED
data/lib/disc.rb
CHANGED
@@ -71,8 +71,8 @@ class Disc
|
|
71
71
|
job = MessagePack.unpack(serialized_job)
|
72
72
|
job.update('id' => msgid, 'queue' => queue)
|
73
73
|
|
74
|
-
instance = Object.const_get(job['class']).new
|
75
74
|
begin
|
75
|
+
instance = Object.const_get(job['class']).new
|
76
76
|
instance.disc_start(job)
|
77
77
|
instance.perform(*job['arguments'])
|
78
78
|
disque.call('ACKJOB', msgid)
|
@@ -92,8 +92,8 @@ class Disc
|
|
92
92
|
|
93
93
|
module Job
|
94
94
|
attr_reader :arguments,
|
95
|
-
:
|
96
|
-
:
|
95
|
+
:disque,
|
96
|
+
:disc_options
|
97
97
|
|
98
98
|
def self.included(base)
|
99
99
|
base.extend(ClassMethods)
|
@@ -114,12 +114,16 @@ class Disc
|
|
114
114
|
@disque = disque
|
115
115
|
end
|
116
116
|
|
117
|
-
def
|
118
|
-
@
|
117
|
+
def disc(options = {})
|
118
|
+
@disc_options = options
|
119
|
+
end
|
120
|
+
|
121
|
+
def disc_options
|
122
|
+
@disc_options ||= {}
|
119
123
|
end
|
120
124
|
|
121
|
-
def queue
|
122
|
-
|
125
|
+
def queue
|
126
|
+
disc_options.fetch(:queue, 'default')
|
123
127
|
end
|
124
128
|
|
125
129
|
def enqueue(*args)
|
@@ -141,10 +145,6 @@ class Disc
|
|
141
145
|
delay: datetime && (datetime.to_time.to_i - DateTime.now.to_time.to_i)
|
142
146
|
)
|
143
147
|
end
|
144
|
-
|
145
|
-
def disc(options = {})
|
146
|
-
self.queue = options.fetch(:queue, 'default')
|
147
|
-
end
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: disc
|
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
|
- pote
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: disque
|
@@ -71,7 +71,6 @@ files:
|
|
71
71
|
- disc.gemspec
|
72
72
|
- examples/disc_init.rb
|
73
73
|
- examples/fail_job.rb
|
74
|
-
- examples/failer.rb
|
75
74
|
- examples/greeter.rb
|
76
75
|
- lib/disc.rb
|
77
76
|
- lib/disc/version.rb
|