@@ -213,9 +213,8 @@ export async function ensureOlmSessionsForDevices(
213213 // synchronous operation, as otherwise it is possible to have deadlocks
214214 // where multiple tasks wait indefinitely on another task to update some set
215215 // of common devices.
216- for ( const [ userId , devices ] of Object . entries ( devicesByUser ) ) {
216+ for ( const [ , devices ] of Object . entries ( devicesByUser ) ) {
217217 for ( const deviceInfo of devices ) {
218- const deviceId = deviceInfo . deviceId ;
219218 const key = deviceInfo . getIdentityKey ( ) ;
220219
221220 if ( key === olmDevice . deviceCurve25519Key ) {
@@ -224,15 +223,12 @@ export async function ensureOlmSessionsForDevices(
224223 continue ;
225224 }
226225
227- const forWhom = `for ${ key } (${ userId } :${ deviceId } )` ;
228226 if ( ! olmDevice . _sessionsInProgress [ key ] ) {
229227 // pre-emptively mark the session as in-progress to avoid race
230228 // conditions. If we find that we already have a session, then
231229 // we'll resolve
232- log . debug ( `Marking Olm session in progress ${ forWhom } ` ) ;
233230 olmDevice . _sessionsInProgress [ key ] = new Promise ( resolve => {
234231 resolveSession [ key ] = ( ...args ) => {
235- log . debug ( `Resolved Olm session in progress ${ forWhom } ` ) ;
236232 delete olmDevice . _sessionsInProgress [ key ] ;
237233 resolve ( ...args ) ;
238234 } ;
@@ -266,11 +262,9 @@ export async function ensureOlmSessionsForDevices(
266262 }
267263
268264 const forWhom = `for ${ key } (${ userId } :${ deviceId } )` ;
269- log . debug ( `Ensuring Olm session ${ forWhom } ` ) ;
270265 const sessionId = await olmDevice . getSessionIdForDevice (
271266 key , resolveSession [ key ] , log ,
272267 ) ;
273- log . debug ( `Got Olm session ${ sessionId } ${ forWhom } ` ) ;
274268 if ( sessionId !== null && resolveSession [ key ] ) {
275269 // we found a session, but we had marked the session as
276270 // in-progress, so resolve it now, which will unmark it and
@@ -299,18 +293,6 @@ export async function ensureOlmSessionsForDevices(
299293 const oneTimeKeyAlgorithm = "signed_curve25519" ;
300294 let res ;
301295 let taskDetail = `one-time keys for ${ devicesWithoutSession . length } devices` ;
302- // If your homeserver takes a nap here and never replies, this process
303- // would hang indefinitely. While that's easily fixed by setting a
304- // timeout on this request, let's first log whether that's the root
305- // cause we're seeing in practice.
306- // See also https://github.com/vector-im/element-web/issues/16194
307- let otkTimeoutLogger ;
308- // XXX: Perhaps there should be a default timeout?
309- if ( otkTimeout ) {
310- otkTimeoutLogger = setTimeout ( ( ) => {
311- log . error ( `Homeserver never replied while claiming ${ taskDetail } ` ) ;
312- } , otkTimeout ) ;
313- }
314296 try {
315297 log . debug ( `Claiming ${ taskDetail } ` ) ;
316298 res = await baseApis . claimOneTimeKeys (
@@ -323,8 +305,6 @@ export async function ensureOlmSessionsForDevices(
323305 }
324306 log . log ( `Failed to claim ${ taskDetail } ` , e , devicesWithoutSession ) ;
325307 throw e ;
326- } finally {
327- clearTimeout ( otkTimeoutLogger ) ;
328308 }
329309
330310 if ( failedServers && "failures" in res ) {
0 commit comments