File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
ProReception.DistributionServerInfrastructure/HostedServices Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,23 @@ private async Task ExecuteStartUp(CancellationToken cancellationToken)
110110
111111 private async Task LoginAndCreateSignalRConnection ( CancellationToken cancellationToken )
112112 {
113+ var hasLoggedMissingTokens = false ;
114+ while ( ! cancellationToken . IsCancellationRequested )
115+ {
116+ if ( settingsManagerBase . GetTokens ( ) != null )
117+ {
118+ break ;
119+ }
120+
121+ if ( ! hasLoggedMissingTokens )
122+ {
123+ logger . LogInformation ( "No tokens available. Waiting for user to log in..." ) ;
124+ hasLoggedMissingTokens = true ;
125+ }
126+
127+ await Task . Delay ( TimeSpan . FromSeconds ( 5 ) , cancellationToken ) ;
128+ }
129+
113130 if ( ! cancellationToken . IsCancellationRequested )
114131 {
115132 logger . LogInformation ( "Establishing SignalR connection..." ) ;
@@ -183,7 +200,7 @@ private async Task LoginAndCreateSignalRConnection(CancellationToken cancellatio
183200 logger . LogWarning ( error , "SignalR connection closed unexpectedly. Attempting to reconnect..." ) ;
184201
185202 // Use semaphore to prevent multiple simultaneous reconnection attempts
186- if ( await reconnectLock . WaitAsync ( 0 ) )
203+ if ( await reconnectLock . WaitAsync ( 0 , cancellationToken ) )
187204 {
188205 try
189206 {
You can’t perform that action at this time.
0 commit comments