news: Merge news more aggressively
News reporting merges news items into recent items with same actor, action and victim, as long as the merged number of times doesn't exceed 65535 (127 before the previous commit). This complicates incremental xdump a bit: when the client sees a row, it's not obvious which of the previously dumped rows it replaces. Actually, rows with the same actor, action, victim and time replace in xdump order. Merge news item regardless of the number of times; saturate the number at 65535. Now the replacement is obvious, because there can only be one news item with the same actor, action, victim and time. This also rate-limits floods of identical news should they happen for some reason. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
fda2ecb910
commit
cbc23ae858
1 changed files with 3 additions and 3 deletions
|
@ -168,9 +168,9 @@ ncache(int actor, int event, int victim, int times)
|
|||
dur = now - np->news.nws_when;
|
||||
if (dur > minutes(5))
|
||||
continue;
|
||||
if (np->news.nws_vrb == event && np->news.nws_vno == victim &&
|
||||
np->news.nws_ntm + times <= 65535) {
|
||||
np->news.nws_ntm += times;
|
||||
if (np->news.nws_vrb == event && np->news.nws_vno == victim) {
|
||||
np->news.nws_ntm = LIMIT_TO(np->news.nws_ntm + times,
|
||||
0, 65535);
|
||||
np->news.nws_duration = dur;
|
||||
return np;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue