File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -144,10 +144,32 @@ async function debuggableNavigatorLock<R>(
144144      } 
145145
146146      console . error ( 
147-         `Waited for over 10s to acquire an Auth client lock` , 
147+         `Waited for over 10s to acquire an Auth client lock, will steal the lock to unblock ` , 
148148        await  navigator . locks . query ( ) , 
149149        stackException 
150150      ) 
151+ 
152+       // quickly steal the lock and release it so that others can acquire it, 
153+       // while leaving the code that was holding it to continue running 
154+       navigator . locks 
155+         . request ( 
156+           name , 
157+           { 
158+             steal : true , 
159+           } , 
160+           async  ( )  =>  { 
161+             await  new  Promise ( ( accept )  =>  { 
162+               setTimeout ( accept ,  0 ) 
163+             } ) 
164+ 
165+             console . error ( 'Lock was stolen and now released' ,  stackException ) 
166+           } 
167+         ) 
168+         . catch ( ( e : any )  =>  { 
169+           if  ( captureException )  { 
170+             captureException ( e ) 
171+           } 
172+         } ) 
151173    } ) ( ) 
152174  } ,  10000 ) 
153175
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments