sucker_punch 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +5 -0
- data/README.md +24 -4
- data/lib/sucker_punch.rb +1 -1
- data/lib/sucker_punch/testing/inline.rb +1 -1
- data/lib/sucker_punch/version.rb +1 -1
- data/sucker_punch.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70cb95da88976f1d553fb0f59738234e405617e
|
4
|
+
data.tar.gz: 8f201650b9af9288cdfc1d07888d9f768aa26154
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca78397b7ce5d1e6e10731c2574e15f9ba4f832cad5417bf5978702201234d55318cdcba59cc8a0026cfbfb34467548c6f904307718ed46bd30c721085c0515b
|
7
|
+
data.tar.gz: b6c9665c64fb2534dcb56746322defd9b0007998ca35040b6e55ae1b134549b4fe553c2b0aeac2e27fe8ef8e12fd902eae99c74bd9a6a8d93997257db5dbc5af
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -105,14 +105,13 @@ If the `workers` method is not set, the default is `2`.
|
|
105
105
|
|
106
106
|
Many background processing libraries have methods to perform operations after a
|
107
107
|
certain amount of time. Fortunately, timers are built-in to Celluloid, so you
|
108
|
-
can take advantage of them with the `
|
108
|
+
can take advantage of them with the `later` method:
|
109
109
|
|
110
110
|
``` ruby
|
111
111
|
class Job
|
112
112
|
include SuckerPunch::Job
|
113
113
|
|
114
114
|
def perform(data)
|
115
|
-
sleep 2
|
116
115
|
puts data
|
117
116
|
end
|
118
117
|
|
@@ -148,6 +147,24 @@ require 'sucker_punch/testing/inline'
|
|
148
147
|
Log.new.async.perform("login") # => Will be synchronous and block until job is finished
|
149
148
|
```
|
150
149
|
|
150
|
+
## Active Job
|
151
|
+
|
152
|
+
Sucker Punch has been added as an Active job adapter in the upcoming Rails 4.2 release.
|
153
|
+
See the [guide](http://edgeguides.rubyonrails.org/active_job_basics.html) for
|
154
|
+
configuration and implementation.
|
155
|
+
|
156
|
+
Add Sucker Punch to your `Gemfile`:
|
157
|
+
|
158
|
+
```Ruby
|
159
|
+
gem 'sucker_punch'
|
160
|
+
```
|
161
|
+
|
162
|
+
And then configure the backend to use Sucker Punch:
|
163
|
+
|
164
|
+
```Ruby
|
165
|
+
Rails.application.config.active_job.queue_adapter = :sucker_punch
|
166
|
+
```
|
167
|
+
|
151
168
|
## Troubleshooting
|
152
169
|
|
153
170
|
### Initializers for forking servers (Unicorn, Passenger, etc.)
|
@@ -177,11 +194,15 @@ end
|
|
177
194
|
|
178
195
|
### Cleaning test data transactions
|
179
196
|
|
180
|
-
If you're running tests in transactions (using Database Cleaner or a native solution), Sucker Punch jobs may have trouble finding database records that were created during test setup because the job class is running in a separate thread and the Transaction operates on a different thread so it clears out the data before the job can do its business. The best thing to do is cleanup data created for tests jobs through a truncation strategy by tagging the rspec tests as jobs and then specifying the strategy in `spec_helper` like below
|
197
|
+
If you're running tests in transactions (using Database Cleaner or a native solution), Sucker Punch jobs may have trouble finding database records that were created during test setup because the job class is running in a separate thread and the Transaction operates on a different thread so it clears out the data before the job can do its business. The best thing to do is cleanup data created for tests jobs through a truncation strategy by tagging the rspec tests as jobs and then specifying the strategy in `spec_helper` like below. And do not forget to turn off transactional fixtures (delete, comment or set it to `false`).
|
181
198
|
|
182
199
|
```Ruby
|
183
200
|
# spec/spec_helper.rb
|
184
201
|
RSpec.configure do |config|
|
202
|
+
|
203
|
+
# Turn off transactional fixtures (delete, comment or set it to `false`)
|
204
|
+
# config.use_transactional_fixtures = true
|
205
|
+
|
185
206
|
config.before(:each) do
|
186
207
|
DatabaseCleaner.strategy = :transaction
|
187
208
|
end
|
@@ -230,4 +251,3 @@ looking for a name for something, he is the one to go to.
|
|
230
251
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
231
252
|
4. Push to the branch (`git push origin my-new-feature`)
|
232
253
|
5. Create new Pull Request
|
233
|
-
|
data/lib/sucker_punch.rb
CHANGED
data/lib/sucker_punch/version.rb
CHANGED
data/sucker_punch.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sucker_punch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Hilkert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.16.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.16.0
|
69
69
|
description: Asynchronous processing library for Ruby
|
70
70
|
email:
|
71
71
|
- brandonhilkert@gmail.com
|