sucker_punch 1.0.1 → 1.0.2
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/CHANGES.md +5 -0
- data/README.md +22 -1
- data/lib/sucker_punch/version.rb +1 -1
- data/spec/sucker_punch/job_spec.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: 993f07c48fd24506ec4f6233b141142a3d4584bf
|
4
|
+
data.tar.gz: 19e5a661fabd7053db509438cd49980d7260e75b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8bad658a733babb44d0fb0e8e680bc7b7e23e5e70a1dd2d37c0d23d0d5f3f81d79f7be7cdef5babffe51ac80171a87079aaa64942cbbf1c4499aad07b8142f4
|
7
|
+
data.tar.gz: 967146bea4c03054314035ebb06e0eb0a70a355c4042fed10c0d276942172e52670183fffa2c41106a7faf6fe591e2a0056b2cabad91d48b198b129c8e32b1e6
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -126,11 +126,32 @@ Log.new.async.perform("login") # => Will be synchronous and block until job is f
|
|
126
126
|
|
127
127
|
## Troubleshooting
|
128
128
|
|
129
|
+
### Initializers for forking servers (Unicorn, Passenger, etc.)
|
130
|
+
|
129
131
|
Previously, Sucker Punch required an initializer and that posed problems for Unicorn and Passenger and other servers that fork.
|
130
132
|
Version 1 was rewritten to not require any special code to be executed after forking occurs. Please remove all of that if you're
|
131
133
|
using version `>= 1.0.0`
|
132
134
|
|
133
|
-
|
135
|
+
### Class naming
|
136
|
+
|
137
|
+
Job classes are ultimately Celluloid Actor classes. As a result, class names are susceptible to being clobbered by Celluloid's internal classes.
|
138
|
+
To ensure the intended application class is loaded, preface classes with `::`, or use names like `NotificationsMailer` or
|
139
|
+
`UserMailer`. Example:
|
140
|
+
|
141
|
+
```Ruby
|
142
|
+
class EmailJob
|
143
|
+
include SuckerPunch::Job
|
144
|
+
|
145
|
+
def perform(contact)
|
146
|
+
@contact = contact
|
147
|
+
::Notifications.contact_form(@contact).deliver # => If you don't use :: in this case, the notifications class from Celluloid will be loaded
|
148
|
+
end
|
149
|
+
end
|
150
|
+
```
|
151
|
+
|
152
|
+
### Cleaning test data transactions
|
153
|
+
|
154
|
+
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 jojob 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:
|
134
155
|
|
135
156
|
```Ruby
|
136
157
|
# spec/spec_helper.rb
|
data/lib/sucker_punch/version.rb
CHANGED
@@ -33,7 +33,7 @@ describe SuckerPunch::Job do
|
|
33
33
|
|
34
34
|
describe "when pool hasn't been created" do
|
35
35
|
it "registers queue" do
|
36
|
-
queue =
|
36
|
+
queue = double("queue")
|
37
37
|
SuckerPunch::Queue.stub(new: queue)
|
38
38
|
queue.should_receive(:register).with(4)
|
39
39
|
pool = FakeJob.new
|
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.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Hilkert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-06 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.15.1
|
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.15.1
|
69
69
|
description: Asynchronous processing library for Ruby
|
70
70
|
email:
|
71
71
|
- brandonhilkert@gmail.com
|