resque_mailer 2.2.5 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f40dbac9ee7d5c35ab40500a905a8a0ef29c92c
4
- data.tar.gz: 151b4ed348d9e7c276316381a2e3f9189732c6e5
3
+ metadata.gz: 53a54447608a2968256ef39072f6308d1dbc2169
4
+ data.tar.gz: e9ff62895bacee201cca55e7f3cb5ed805302cb4
5
5
  SHA512:
6
- metadata.gz: 7ab3baa2fdae11bc4c44fa9849c5e766d43d68f376abb76ce66e7cd41716858944534cbd7798509103c33b2ef12260e9ff0cd9b92fa39c7e02455ec17b9c658d
7
- data.tar.gz: 17c8260b7eb423f7086af7a0e65f0a1a44c7872ba45907fe2cf92f523a279510b91d86581ba77b20ee82bc5bbb96c95ac0cf890cfbe6fa230903f4294ca3f5ce
6
+ metadata.gz: c49ea092064b92528689c38ac49eac32d1c0f451c4e56701a27ac0b3c713609d9bd6daaf1b0e1d6e2245c05168f2ae2dd84fa979d4ba6dfe7f06dca4fdf14de4
7
+ data.tar.gz: 6be3cbf5e72deba7c4950f22f01effb46e0c6f2a7a20a02b83eaca5be5218166f7bfead4ae8ed75b4050a7359b502091c2b4b192f2be0cb363fb54470da42c94
@@ -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
- behavios when perform_deliveries is false, etc.
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
  [![Build Status](https://secure.travis-ci.org/zapnap/resque_mailer.png)](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 (http://github.com/defunkt/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
@@ -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.call(self, message, ex)
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
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module Mailer
3
- VERSION = "2.2.5"
3
+ VERSION = "2.2.6"
4
4
  end
5
5
  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.5
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-10-11 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer