Skip to content

Increase LastUpdate timestamp precission

Alexander Markevich requested to merge hummermania/policyd:fix_time_prec into master

Hello!

We use policyd on the intensivelly sending e-mail server. Amount of e-mails - 1M per day. We use only one rule - 100 e-mails from one recipient per time period.

In the exploitation process we see in log that quota counter maybe grow on by one. Also I see that 3-5 e-mail sending in one second - maximal precission on timestamp field, that quota counter dont increase. But sometimes he can revert to negative value.

This some buggy behaviour make many trouble for us.

I use this fix and test it in production some months. Inspecting log and monitoring graph show that we dramatically decrease situation when one recipient send e-mails above the quota - 200-300 and more. Because they had negative value on the quota counter or they dont grow.

Now I also testing additional fix with transaction begin and commit.

ex.

Now we have only some bugs in counter like this:

03:47:19 quota=6.24/100 (6.2%), last_update=1488847639.78458, pid=15310,
03:47:19 quota=7.24/100 (7.2%), last_update=1488847639.81541, pid=24140,
03:47:19 quota=8.24/100 (8.2%), last_update=1488847639.81785, pid=24165,    <--  equally timestamp
03:47:19 quota=8.24/100 (8.2%), last_update=1488847639.81785, pid=24171,    <--  from different pid

Merge request reports