diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-13 15:52:10 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-13 15:52:10 +0000 |
commit | 52a47b8cfb1c9acaa1bd0dd78ec295c32849417d (patch) | |
tree | e4e4f270e1a9d2443a9435c30e4de3884592544a /src/libserver/protocol.c | |
parent | f4093e086e3edd5cbf12eb8d37c88e7343b22840 (diff) | |
download | rspamd-52a47b8cfb1c9acaa1bd0dd78ec295c32849417d.tar.gz rspamd-52a47b8cfb1c9acaa1bd0dd78ec295c32849417d.zip |
[Feature] Cache and insert scan time into the protocol
Diffstat (limited to 'src/libserver/protocol.c')
-rw-r--r-- | src/libserver/protocol.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index b64f06d97..3096263da 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -1111,6 +1111,10 @@ rspamd_protocol_write_ucl (struct rspamd_task *task, cached->flags = flags; rspamd_mempool_set_variable (task->task_pool, varname, cached, rspamd_protocol_cached_dtor); + + /* We also set scan time here */ + task->time_real_finish = rspamd_get_ticks (); + task->time_virtual_finish = rspamd_get_virtual_ticks (); } if (flags & RSPAMD_PROTOCOL_METRICS) { @@ -1167,6 +1171,12 @@ rspamd_protocol_write_ucl (struct rspamd_task *task, if (flags & RSPAMD_PROTOCOL_BASIC) { ucl_object_insert_key (top, ucl_object_fromstring (task->message_id), "message-id", 0, false); + ucl_object_insert_key (top, + ucl_object_fromdouble (task->time_real_finish - task->time_real), + "time-real", 0, false); + ucl_object_insert_key (top, + ucl_object_fromdouble (task->time_virtual_finish - task->time_virtual), + "time-virtual", 0, false); } if (flags & RSPAMD_PROTOCOL_DKIM) { |