disc 0.0.18 → 0.0.19
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 +37 -4
- data/lib/active_job/queue_adapters/disc_adapter.rb +1 -0
- data/lib/disc.rb +1 -1
- data/lib/disc/version.rb +1 -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: ef1c9ba1d12dd36f6ebbdcd38d2da62f9d5390f4
|
4
|
+
data.tar.gz: 893aa8601a0c096aa356696115c54187336989fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4a3f2476df67bae5fefa2ffccf83e2a006f8dd4aa8f91c9defbe5d1dd3e48d5085c3974912134067bf97e0f8c6e44d9f001dfc5d7929acf86d33c38421882fc
|
7
|
+
data.tar.gz: 41afd9edc3fd42ed2469c72095b102f1b463f7ac92a6a66648aa141a867b389c725ac2b6f19b1e9d508c325197531ef5379ceeeba0f6976dde16972d26377627
|
data/README.md
CHANGED
@@ -58,6 +58,29 @@ Disc fills the gap between your Ruby service objects and [antirez](http://antire
|
|
58
58
|
```bash
|
59
59
|
$ QUEUES=urgent,default disc -r ./disc_init.rb
|
60
60
|
```
|
61
|
+
|
62
|
+
## Notes about Jobs
|
63
|
+
|
64
|
+
Jobs are fairly straighforward Ruby classes, internally Disc serializes them to MessagePack so they can be stored in Disque, this has a few implications:
|
65
|
+
|
66
|
+
* Don't enqueue complex objects! Instead of `user`, enqueue `user.id`!
|
67
|
+
* If your job takes multiple arguments, you'll want to pass all those arguments in the first parameter of `#enqueue` as an array.
|
68
|
+
|
69
|
+
Example:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
class ComplexJob
|
73
|
+
include Disc::Job
|
74
|
+
disc queue: 'urgent'
|
75
|
+
|
76
|
+
def perform(first_parameter, second_parameter)
|
77
|
+
# do things...
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
ComplexJob.enqueue(['first argument', { second: 'argument' }]
|
83
|
+
```
|
61
84
|
|
62
85
|
## Settings
|
63
86
|
|
@@ -100,7 +123,7 @@ The error handler function gets the data of the current job as a Hash, that has
|
|
100
123
|
|
101
124
|
## [Optional] Celluloid integration
|
102
125
|
|
103
|
-
Disc workers
|
126
|
+
Disc workers run just fine on their own, but if you happen to be using
|
104
127
|
[Celluloid](https://github.com/celluloid/celluloid) you might want Disc to take
|
105
128
|
advantage of it and spawn multiple worker threads per process, doing this is
|
106
129
|
trivial! Just require Celluloid before your init file:
|
@@ -113,7 +136,7 @@ Whenever Disc detects that Celluloid is available it will use it to spawn a
|
|
113
136
|
number of threads equal to the `DISC_CONCURRENCY` environment variable, or 25 by
|
114
137
|
default.
|
115
138
|
|
116
|
-
## Rails and ActiveJob integration
|
139
|
+
## [Optional] Rails and ActiveJob integration
|
117
140
|
|
118
141
|
You can use Disc easily in Rails without any more hassle, but if you'd like to use it via [ActiveJob](http://edgeguides.rubyonrails.org/active_job_basics.html) you can use the adapter included in this gem.
|
119
142
|
|
@@ -139,17 +162,27 @@ class CluJob < ActiveJob::Base
|
|
139
162
|
end
|
140
163
|
end
|
141
164
|
|
165
|
+
# disc_init.rb
|
166
|
+
require ::File.expand_path('../config/environment', __FILE__)
|
167
|
+
|
142
168
|
# Wherever you want
|
143
169
|
CluJob.perform_later(a_bunch_of_arguments)
|
144
170
|
```
|
145
171
|
|
146
|
-
|
172
|
+
Disc is run in the exact same way, for this example it'd be:
|
147
173
|
|
174
|
+
```bash
|
175
|
+
$ QUEUES=urgent disc -r ./disc_init.rb
|
176
|
+
```
|
148
177
|
|
149
178
|
## A note on stability
|
150
179
|
|
151
180
|
The version of Disque at the time of this writing is `0.0.1`. It is a wonderful project, I know of people running it in production and I expect it will only get better and better with time, but please do not expect Disc to be more production ready than Disque is.
|
152
181
|
|
182
|
+
## Similar Projects
|
183
|
+
|
184
|
+
If you want to use Disque but Disc isn't cutting it for you then you should take a look at [Havanna](https://github.com/djanowski/havanna), a project by my friend [@djanowski](https://twitter.com/djanowski).
|
185
|
+
|
153
186
|
## License
|
154
187
|
|
155
188
|
The code is released under an MIT license. See the [LICENSE](./LICENSE) file for
|
@@ -157,7 +190,7 @@ more information.
|
|
157
190
|
|
158
191
|
## Acknowledgements
|
159
192
|
|
160
|
-
* To [@
|
193
|
+
* To [@foca](https://github.com/foca) for helping me ship a quality thing and putting up with my constant whining.
|
161
194
|
* To [@antirez](https://github,com/antirez) for Redis, Disque, and his refreshing way of programming wonderful tools.
|
162
195
|
* To [@soveran](https://github.com/soveran) for pushing me to work on this and publishing gems that keep me enjoying ruby.
|
163
196
|
* To [all contributors](https://github.com/pote/disc/graphs/contributors)
|
data/lib/disc.rb
CHANGED
data/lib/disc/version.rb
CHANGED
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.19
|
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-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: disque
|