-
-
Save anonymous/450af60525af294150cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojolicious/Plugin/DefaultHelpers.pm b/lib/Mojolicious/Plugin/D | |
index 00e9f5b..eae6a62 100644 | |
--- a/lib/Mojolicious/Plugin/DefaultHelpers.pm | |
+++ b/lib/Mojolicious/Plugin/DefaultHelpers.pm | |
@@ -230,13 +230,16 @@ Check or get name of current route. | |
Disable automatic rendering and use L<Mojo::IOLoop/"delay"> to manage | |
callbacks and control the flow of events, which can help you avoid deep nested | |
closures and memory leaks that often result from continuation-passing style. | |
-Calls L<Mojolicious::Controller/"render_exception"> if an error occured in one | |
-of the steps, breaking the chain. | |
+Also keeps a reference to L<Mojolicious::Controller/"tx"> in case the | |
+underlying connection gets closed early and calls | |
+L<Mojolicious::Controller/"render_exception"> if an error occured in one of | |
+the steps, breaking the chain. | |
# Longer version | |
$c->render_later; | |
+ my $tx = $c->tx; | |
my $delay = Mojo::IOLoop->delay(sub {...}, sub {...}); | |
- $delay->catch(sub { $c->render_exception(pop) })->wait; | |
+ $delay->catch(sub { $c->render_exception(pop) and undef $tx })->wait; | |
=head2 dumper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment