Skip to content

Commit

Permalink
fix: stale meeting mappings due to incorrect inactivity report
Browse files Browse the repository at this point in the history
Some mappings are being incorrectly restored when a meeting ends due to
the "meeting-ended" event counting towards mapping activity. EOL events
should not count as activity as the mapping is supposed to be deleted
anyway.

Ignore "meeting-ended" when report meeting mapping activity.
  • Loading branch information
prlanzarin committed Sep 19, 2024
1 parent 36b6614 commit ddc63f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.

* fix: handle missing checksum in API requests
* fix: cleanup corrupted Redis mappings
* fix: stale meeting mappings due to incorrect inactivity report
* build: express@4.21.0
* build: sinon@19.0.2

Expand Down
16 changes: 15 additions & 1 deletion src/process/event-processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ export default class EventProcessor {
return parsedEvent;
}

_shouldReportActivity(event) {
const ignoreList = [
'meeting-ended',
];

// If the event is in the ignore list, we don't want to report activity.
// Generally speaking, EOL events should not be considered for activity tracking
// as mappings will be deleted anyway.
return event?.data?.id && !ignoreList.includes(event.data.id);
}

// TODO move this to an event factory
// Spoofs a user left event for a given user when a meeting ends (so that the user
// is removed from the user mapping AND the user left event is sent to output modules).
Expand Down Expand Up @@ -182,7 +193,10 @@ export default class EventProcessor {
if (!Utils.isEmpty(outputEvent)) {
Logger.trace('raw event succesfully parsed', { rawEvent });
const internalMeetingId = outputEvent.data.attributes.meeting["internal-meeting-id"];
IDMapping.get().reportActivity(internalMeetingId);

if (this._shouldReportActivity(outputEvent)) {
IDMapping.get().reportActivity(internalMeetingId);
}

// Any kind of retrocompatibility logic, output event post-processing,
// data storage et al. should be done here.
Expand Down

0 comments on commit ddc63f4

Please sign in to comment.