Jdlrobson has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/342152 )
Change subject: Purge based on current timestamp ...................................................................... Purge based on current timestamp To process old events correctly we shouldnt use the current timestamp as it will lead to incorrect calculations of speed as well as inactivity. Bug: T160136 Change-Id: If27b50bb4dbc3d6090f14d31d4c4ed8bdd431171 --- M app.js 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/trending-edits refs/changes/52/342152/1 diff --git a/app.js b/app.js index 0a9cfb3..0653c44 100644 --- a/app.js +++ b/app.js @@ -196,19 +196,21 @@ */ function createEditStream(app) { var eventsSincePurge = 0; + let last_event_ts; const editStream = new EditStream(app.conf); editStream.on('edit', (message) => { if (processor.process(message)) { + last_event_ts = new Date(message.meta.dt); app.logger.log('trace/event', () => ({ msg: 'Event processed', event: JSON.stringify(message) })); - app.metrics.endTiming(`${message.meta.topic}.delay`, new Date(message.meta.dt)); + app.metrics.endTiming(`${message.meta.topic}.delay`, last_event_ts); eventsSincePurge++; } if (eventsSincePurge > app.conf.purge_period) { eventsSincePurge = 0; - processor.purge(new Date(), app.conf.purge_strategy); + processor.purge(last_event_ts, app.conf.purge_strategy); app.metrics.increment('purge'); } }); -- To view, visit https://gerrit.wikimedia.org/r/342152 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If27b50bb4dbc3d6090f14d31d4c4ed8bdd431171 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/trending-edits Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits