@@ -232,18 +232,23 @@ export async function ensureOlmSessionsForDevices(
232232 continue ;
233233 }
234234
235+ const forWhom = `for ${ key } (${ userId } :${ deviceId } )` ;
236+ log . debug ( `Ensuring Olm session ${ forWhom } ` ) ;
235237 if ( ! olmDevice . _sessionsInProgress [ key ] ) {
236238 // pre-emptively mark the session as in-progress to avoid race
237239 // conditions. If we find that we already have a session, then
238240 // we'll resolve
241+ log . debug ( `Marking Olm session in progress ${ forWhom } ` ) ;
239242 olmDevice . _sessionsInProgress [ key ] = new Promise (
240243 ( resolve , reject ) => {
241244 resolveSession [ key ] = {
242245 resolve : ( ...args ) => {
246+ log . debug ( `Resolved Olm session in progress ${ forWhom } ` ) ;
243247 delete olmDevice . _sessionsInProgress [ key ] ;
244248 resolve ( ...args ) ;
245249 } ,
246250 reject : ( ...args ) => {
251+ log . debug ( `Rejected Olm session in progress ${ forWhom } ` ) ;
247252 delete olmDevice . _sessionsInProgress [ key ] ;
248253 reject ( ...args ) ;
249254 } ,
@@ -254,6 +259,7 @@ export async function ensureOlmSessionsForDevices(
254259 const sessionId = await olmDevice . getSessionIdForDevice (
255260 key , resolveSession [ key ] ,
256261 ) ;
262+ log . debug ( `Got Olm session ${ sessionId } ${ forWhom } ` ) ;
257263 if ( sessionId !== null && resolveSession [ key ] ) {
258264 // we found a session, but we had marked the session as
259265 // in-progress, so unmark it and unblock anything that was
@@ -264,9 +270,9 @@ export async function ensureOlmSessionsForDevices(
264270 }
265271 if ( sessionId === null || force ) {
266272 if ( force ) {
267- log . info ( `Forcing new Olm session for ${ userId } : ${ deviceId } ` ) ;
273+ log . info ( `Forcing new Olm session ${ forWhom } ` ) ;
268274 } else {
269- log . info ( `Making new Olm session for ${ userId } : ${ deviceId } ` ) ;
275+ log . info ( `Making new Olm session ${ forWhom } ` ) ;
270276 }
271277 devicesWithoutSession . push ( [ userId , deviceId ] ) ;
272278 }
0 commit comments