Bug 1102146: reduce the amount of HAWK requests for rooms getAll. r=Standard8
authorMike de Boer <mdeboer@mozilla.com>
Fri, 21 Nov 2014 11:23:08 +0100
changeset 241194 0cad1e05f68944ec4a94955ebe78096048d21485
parent 241193 67a565ca21d6e584e6c9f8d9d7d9d4706e8f8dea
child 241195 da918fa50e5feed069b591a7bf5c407ab2dde5f6
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1102146
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1102146: reduce the amount of HAWK requests for rooms getAll. r=Standard8
browser/components/loop/LoopRooms.jsm
--- a/browser/components/loop/LoopRooms.jsm
+++ b/browser/components/loop/LoopRooms.jsm
@@ -179,26 +179,20 @@ let LoopRoomsInternal = {
         if (orig) {
           checkForParticipantsUpdate(orig, room);
         }
         // Remove the `currSize` for posterity.
         if ("currSize" in room) {
           delete room.currSize;
         }
         this.rooms.set(room.roomToken, room);
-        // When a version is specified, all the data is already provided by this
-        // request.
-        if (version) {
-          eventEmitter.emit("update", room);
-          eventEmitter.emit("update" + ":" + room.roomToken, room);
-        } else {
-          // Next, request the detailed information for each room. If the request
-          // fails the room data will not be added to the map.
-          yield LoopRooms.promise("get", room.roomToken);
-        }
+        
+        let eventName = orig ? "update" : "add";
+        eventEmitter.emit(eventName, room);
+        eventEmitter.emit(eventName + ":" + room.roomToken, room);
       }
 
       // If there's no rooms in the list, remove the guest created room flag, so that
       // we don't keep registering for guest when we don't need to.
       if (this.sessionType == LOOP_SESSION_TYPE.GUEST && !this.rooms.size) {
         this.setGuestCreatedRoom(false);
       }