diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-02 13:18:18 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-07-02 13:18:18 +0100 |
commit | be8b548ac0dbb9fb0ee65dbffc2f0ebe14f6cc59 (patch) | |
tree | 8212863e55db302d85373c0c1c95252ec21abf49 /src/controller.c | |
parent | 47d2721f8b7a7f2c40a0cea3c3b1040450546d69 (diff) | |
download | rspamd-be8b548ac0dbb9fb0ee65dbffc2f0ebe14f6cc59.tar.gz rspamd-be8b548ac0dbb9fb0ee65dbffc2f0ebe14f6cc59.zip |
[Fix] Fix rows calculation in graph
Diffstat (limited to 'src/controller.c')
-rw-r--r-- | src/controller.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/controller.c b/src/controller.c index 486957375..b45e5add5 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1170,7 +1170,8 @@ rspamd_controller_handle_graph ( step = (rrd_result->rra_rows / desired_points + 0.5); acc = g_malloc0 (sizeof (double) * rrd_result->ds_count * step); - for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; cnt ++) { + for (i = start_row, cnt = 0; cnt < rrd_result->rra_rows; + cnt ++) { for (j = 0; j < rrd_result->ds_count; j++) { if (k < step) { /* Just update window */ @@ -1187,7 +1188,13 @@ rspamd_controller_handle_graph ( } } - i = start_row == 0 ? i + 1 : (i + 1) % start_row; + if (i == rrd_result->rra_rows - 1) { + i = 0; + } + else { + i ++; + } + ts ++; } |