mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-02 12:48:57 +01:00
dedup all events
This commit is contained in:
parent
a1bf28b7f0
commit
6e341aebab
1 changed files with 42 additions and 31 deletions
|
@ -42,6 +42,11 @@ angular.module('eventHandlerService', [])
|
||||||
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
rooms: {} // will contain roomId: { messages:[], members:{userid1: event} }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// used for dedupping events - could be expanded in future...
|
||||||
|
// FIXME: means that we leak memory over time (along with lots of the rest
|
||||||
|
// of the app, given we never try to reap memory yet)
|
||||||
|
var eventMap = {};
|
||||||
|
|
||||||
$rootScope.presence = {};
|
$rootScope.presence = {};
|
||||||
|
|
||||||
var initRoom = function(room_id) {
|
var initRoom = function(room_id) {
|
||||||
|
@ -156,8 +161,16 @@ angular.module('eventHandlerService', [])
|
||||||
CALL_EVENT: CALL_EVENT,
|
CALL_EVENT: CALL_EVENT,
|
||||||
NAME_EVENT: NAME_EVENT,
|
NAME_EVENT: NAME_EVENT,
|
||||||
|
|
||||||
|
|
||||||
handleEvent: function(event, isLiveEvent) {
|
handleEvent: function(event, isLiveEvent) {
|
||||||
|
if (eventMap[event.event_id]) {
|
||||||
|
console.log("discarding duplicate event: " + JSON.stringify(event));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type.indexOf('m.call.') === 0) {
|
||||||
|
handleCallEvent(event, isLiveEvent);
|
||||||
|
}
|
||||||
|
else {
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
case "m.room.create":
|
case "m.room.create":
|
||||||
handleRoomCreate(event, isLiveEvent);
|
handleRoomCreate(event, isLiveEvent);
|
||||||
|
@ -189,8 +202,6 @@ angular.module('eventHandlerService', [])
|
||||||
console.log(JSON.stringify(event, undefined, 4));
|
console.log(JSON.stringify(event, undefined, 4));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (event.type.indexOf('m.call.') === 0) {
|
|
||||||
handleCallEvent(event, isLiveEvent);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue