From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-api v2 2/4] pmg-smtp-filter: cleanup use of gettimeofday
Date: Fri, 12 Jan 2024 20:21:49 +0100 [thread overview]
Message-ID: <20240112192151.40998-4-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20240112192151.40998-1-s.ivanov@proxmox.com>
in preparation for handling a processing timeout and passing the
startime to apply_rules, just unify the different syntax we use
throught the file.
no semantic change intended.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
src/bin/pmg-smtp-filter | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/bin/pmg-smtp-filter b/src/bin/pmg-smtp-filter
index 7da3de8..ba4e58e 100755
--- a/src/bin/pmg-smtp-filter
+++ b/src/bin/pmg-smtp-filter
@@ -524,7 +524,7 @@ sub run_dequeue {
$self->log (2, "starting database maintenance");
- my ($csec, $usec) = gettimeofday ();
+ my $starttime = [ gettimeofday() ];
my $cinfo = PVE::INotify::read_file("cluster.conf");
@@ -540,8 +540,7 @@ sub run_dequeue {
if ($err) {
$self->log (0, $err);
} else {
- my ($csec_end, $usec_end) = gettimeofday ();
- my $ptime = int (($csec_end - $csec) * 1000 + ($usec_end - $usec) / 1000);
+ my $ptime = int(tv_interval($starttime) * 1000);
$self->log (2, "end database maintenance ($ptime ms)");
}
@@ -560,7 +559,7 @@ sub unpack_entity {
if (PMG::Unpack::is_archive ($magic)) {
$self->log (3, "$queue->{logid}: found archive '$filename' ($magic)");
- my $start = [gettimeofday];
+ my $start = [ gettimeofday() ];
$unpack->{mime} = {};
@@ -591,7 +590,7 @@ sub unpack_entity {
sub handle_smtp {
my ($self, $smtp) = @_;
- my ($csec, $usec) = gettimeofday ();
+ my $starttime = [ gettimeofday() ];
my $queue;
my $msginfo = {};
@@ -714,7 +713,7 @@ sub handle_smtp {
my $decdir = $queue->{dumpdir} . "/__decoded_archives";
mkdir $decdir;
- my $start = [gettimeofday];
+ my $start = [ gettimeofday() ];
my $unpack;
eval {
@@ -769,9 +768,7 @@ sub handle_smtp {
die $err if $err;
- my ($csec_end, $usec_end) = gettimeofday ();
- my $time_total =
- int (($csec_end-$csec)*1000 + ($usec_end - $usec)/1000);
+ my $time_total = int(tv_interval($starttime) * 1000);
# PHASE 5 - log statistics
# on error: log error messages
--
2.39.2
next prev parent reply other threads:[~2024-01-12 19:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 19:21 [pmg-devel] [PATCH pmg-api/pmg-docs v2] make filter timeout configurable Stoiko Ivanov
2024-01-12 19:21 ` [pmg-devel] [PATCH pmg-docs v2 1/1] doc-generator: add new option filter-timeout Stoiko Ivanov
2024-01-12 19:21 ` [pmg-devel] [PATCH pmg-api v2 1/4] templates: postfix: set same timeouts for before and after-queue Stoiko Ivanov
2024-01-12 19:21 ` Stoiko Ivanov [this message]
2024-01-12 19:21 ` [pmg-devel] [PATCH pmg-api v2 3/4] config: postfix: make smtp-filter-timeout configurable Stoiko Ivanov
2024-01-12 19:21 ` [pmg-devel] [PATCH pmg-api v2 4/4] pmg-smtp-filter: die if processing took longer than the timeout Stoiko Ivanov
2024-02-21 14:35 ` [pmg-devel] [PATCH pmg-api/pmg-docs v2] make filter timeout configurable Dominik Csapak
2024-02-22 15:23 ` [pmg-devel] applied-series: " Thomas Lamprecht
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=20240112192151.40998-4-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pmg-devel@lists.proxmox.com \
/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