Skip to content

Instantly share code, notes, and snippets.

/fast_write.diff Secret

Created September 8, 2014 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1f8e862f764930e51fe7 to your computer and use it in GitHub Desktop.
Save anonymous/1f8e862f764930e51fe7 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/IOLoop/Stream.pm b/lib/Mojo/IOLoop/Stream.pm
index 5dcb939..611e60c 100644
--- a/lib/Mojo/IOLoop/Stream.pm
+++ b/lib/Mojo/IOLoop/Stream.pm
@@ -85,6 +85,7 @@ sub write {
my ($self, $chunk, $cb) = @_;
$self->{buffer} .= $chunk;
+ $self->_write;
if ($cb) { $self->once(drain => $cb) }
elsif (!length $self->{buffer}) { return $self }
$self->reactor->watch($self->{handle}, !$self->{paused}, 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment