File tree Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -115,10 +115,37 @@ public async Task<int> KillConnectionAsync(string containerId)
115115 return killed ;
116116 }
117117
118- public Task < Queue > GetQueueAsync ( string queueNameStr )
118+ public async Task < Queue > GetQueueAsync ( string queueNameStr )
119119 {
120- var queueName = new QueueName ( queueNameStr , "/" ) ;
121- return _managementClient . GetQueueAsync ( queueName ) ;
120+ ushort retries = 20 ;
121+ do
122+ {
123+ try
124+ {
125+ var queueName = new QueueName ( queueNameStr , "/" ) ;
126+ return await _managementClient . GetQueueAsync ( queueName ) ;
127+ }
128+ catch ( UnexpectedHttpStatusCodeException ex )
129+ {
130+ if ( ex . StatusCode == HttpStatusCode . NotFound )
131+ {
132+ retries -- ;
133+ if ( retries == 0 )
134+ {
135+ throw ;
136+ }
137+ }
138+ else
139+ {
140+ throw ;
141+ }
142+ }
143+
144+ await Task . Delay ( 500 ) ;
145+
146+ } while ( retries >= 0 ) ;
147+
148+ throw new InvalidOperationException ( $ "could not retrieve queue '{ queueNameStr } ' within 10 seconds!") ;
122149 }
123150
124151 public async Task < bool > CheckExchangeAsync ( string exchangeNameStr , bool checkExisting = true )
You can’t perform that action at this time.
0 commit comments