resque_mailer 2.2.5 → 2.2.6
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/CHANGELOG.md +7 -1
- data/README.md +20 -2
- data/lib/resque_mailer.rb +7 -2
- data/lib/resque_mailer/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: 53a54447608a2968256ef39072f6308d1dbc2169
|
4
|
+
data.tar.gz: e9ff62895bacee201cca55e7f3cb5ed805302cb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c49ea092064b92528689c38ac49eac32d1c0f451c4e56701a27ac0b3c713609d9bd6daaf1b0e1d6e2245c05168f2ae2dd84fa979d4ba6dfe7f06dca4fdf14de4
|
7
|
+
data.tar.gz: 6be3cbf5e72deba7c4950f22f01effb46e0c6f2a7a20a02b83eaca5be5218166f7bfead4ae8ed75b4050a7359b502091c2b4b192f2be0cb363fb54470da42c94
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
### EDGE / 2013-11-12
|
2
|
+
* Add action and args as arguments to the error handler lambda for
|
3
|
+
requeuing (Ellis Berner, Austen Ito)
|
4
|
+
* Redis client v3 support; fix unhandled exception when offline
|
5
|
+
(Yoav Matchulsky)
|
6
|
+
|
1
7
|
### 2.2.5 / 2013-10-10
|
2
8
|
* Travis Integration (Peter Goldstein)
|
3
9
|
* ActionMailer 4.0 test compatibility (Peter Goldstein)
|
@@ -15,7 +21,7 @@
|
|
15
21
|
|
16
22
|
### 2.2.2 / 2013-01-27
|
17
23
|
* Fall back to deliver (not deliver!) on actual message, expected
|
18
|
-
|
24
|
+
behavior when perform_deliveries is false, etc.
|
19
25
|
|
20
26
|
### 2.2.1 / 2012-12-09
|
21
27
|
* Added optional support for synchronous fallback (Lee Edwards and
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
[](http://travis-ci.org/zapnap/resque_mailer)
|
4
4
|
|
5
5
|
A gem plugin which allows messages prepared by ActionMailer to be delivered
|
6
|
-
asynchronously. Assumes you're using Resque
|
6
|
+
asynchronously. Assumes you're using [Resque](https://github.com/resque/resque)
|
7
7
|
for your background jobs.
|
8
8
|
|
9
9
|
Note that recent (2.0+) versions of Resque::Mailer only work with Rails 3.x or 4.x.
|
@@ -58,15 +58,33 @@ name when starting your workers.
|
|
58
58
|
|
59
59
|
QUEUE=application_specific_mailer rake environment resque:work
|
60
60
|
|
61
|
-
Custom handling of errors that arise when sending a message is possible by
|
61
|
+
Custom handling of errors that arise when sending a message is possible by
|
62
62
|
assigning a lambda to the `error_hander` attribute.
|
63
63
|
|
64
|
+
There are two supported lambdas for backwards compatiability:
|
65
|
+
|
66
|
+
The first lamba will be deprecated in a future release:
|
67
|
+
|
64
68
|
```ruby
|
65
69
|
Resque::Mailer.error_handler = lambda { |mailer, message, error|
|
66
70
|
# some custom error handling code here in which you optionally re-raise the error
|
67
71
|
}
|
68
72
|
```
|
69
73
|
|
74
|
+
The new lamba contains two other arguments, action and args, which allows
|
75
|
+
mailers to be requeued on failure:
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
Resque::Mailer.error_handler = lambda { |mailer, message, error, action, args|
|
79
|
+
# Necessary to re-enqueue jobs that receieve the SIGTERM signal
|
80
|
+
if exception.is_a?(Resque::TermException)
|
81
|
+
Resque.enqueue(mailer, action, *args)
|
82
|
+
else
|
83
|
+
raise exception
|
84
|
+
end
|
85
|
+
}
|
86
|
+
```
|
87
|
+
|
70
88
|
### Resque::Mailer as a Project Default
|
71
89
|
|
72
90
|
If you have a variety of mailers in your application and want all of them to use
|
data/lib/resque_mailer.rb
CHANGED
@@ -49,7 +49,12 @@ module Resque
|
|
49
49
|
message.deliver
|
50
50
|
rescue Exception => ex
|
51
51
|
if Mailer.error_handler
|
52
|
-
Mailer.error_handler.
|
52
|
+
if Mailer.error_handler.arity == 3
|
53
|
+
warn "WARNING: error handlers with 3 arguments are deprecated and will be removed in the next release"
|
54
|
+
Mailer.error_handler.call(self, message, ex)
|
55
|
+
else
|
56
|
+
Mailer.error_handler.call(self, message, ex, action, args)
|
57
|
+
end
|
53
58
|
else
|
54
59
|
if logger
|
55
60
|
logger.error "Unable to deliver email [#{action}]: #{ex}"
|
@@ -122,7 +127,7 @@ module Resque
|
|
122
127
|
if @mailer_class.deliver?
|
123
128
|
begin
|
124
129
|
resque.enqueue(@mailer_class, @method_name, *@args)
|
125
|
-
rescue Errno::ECONNREFUSED
|
130
|
+
rescue Errno::ECONNREFUSED, Redis::CannotConnectError
|
126
131
|
logger.error "Unable to connect to Redis; falling back to synchronous mail delivery" if logger
|
127
132
|
deliver!
|
128
133
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Plante
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|