From: Dan Nicholson <dbn.lists@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH] send-email: Allow sleeping between sending mails
Date: Sat, 8 Dec 2007 09:12:07 -0800 [thread overview]
Message-ID: <1197133927-32547-1-git-send-email-dbn.lists@gmail.com> (raw)
Sometimes when sending many mails, the thread appears out of order for
the recipient. This adds a simple workaround by sleeping between sending
mails. This is controlled by the option --sleep, which defaults to 0.
Since the perl builtin function sleep is used, only integer granularity
is offered. GetOptions seems to perform the necessary checking for this.
Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
---
Documentation/git-send-email.txt | 5 +++++
git-send-email.perl | 14 +++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 659215a..45341db 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -71,6 +71,11 @@ The --cc option must be repeated for each user you want on the cc list.
Default is the value of 'sendemail.signedoffcc' configuration value;
if that is unspecified, default to --signed-off-by-cc.
+--sleep::
+ Specify an integer number of seconds to sleep between sending
+ mails. This can help when sending many mails at once and they
+ appear out of order for the recipient. Defaults to 0.
+
--quiet::
Make git-send-email less verbose. One line per email should be
all that is output.
diff --git a/git-send-email.perl b/git-send-email.perl
index 76baa8e..a105306 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -100,6 +100,9 @@ Options:
--envelope-sender Specify the envelope sender used to send the emails.
+ --sleep Specify an integer number of seconds to sleep between
+ sending mails. Defaults to 0.
+
EOT
exit(1);
}
@@ -158,6 +161,7 @@ my (@to,@cc,@initial_cc,@bcclist,@xh,
$initial_reply_to,$initial_subject,@files,$author,$sender,$compose,$time);
my $envelope_sender;
+my $mail_index;
# Example reply to:
#$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>';
@@ -171,7 +175,7 @@ if ($@) {
}
# Behavior modification variables
-my ($quiet, $dry_run) = (0, 0);
+my ($quiet, $dry_run, $sleep_time) = (0, 0, 0);
# Variables with corresponding config settings
my ($thread, $chain_reply_to, $suppress_from, $signed_off_cc, $cc_cmd);
@@ -222,6 +226,7 @@ my $rc = GetOptions("sender|from=s" => \$sender,
"dry-run" => \$dry_run,
"envelope-sender=s" => \$envelope_sender,
"thread!" => \$thread,
+ "sleep=i" => \$sleep_time,
);
unless ($rc) {
@@ -669,6 +674,7 @@ X-Mailer: git-send-email $gitversion
$reply_to = $initial_reply_to;
$references = $initial_reply_to || '';
$subject = $initial_subject;
+$mail_index = 0;
foreach my $t (@files) {
open(F,"<",$t) or die "can't open file $t";
@@ -803,6 +809,12 @@ foreach my $t (@files) {
$references = "$message_id";
}
}
+
+ # sleep if requested and there are any mails left
+ if ($sleep_time > 0 && $mail_index < $#files) {
+ sleep $sleep_time;
+ }
+ $mail_index++;
}
if ($compose) {
--
1.5.3.2
reply other threads:[~2007-12-08 17:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1197133927-32547-1-git-send-email-dbn.lists@gmail.com \
--to=dbn.lists@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).