File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
DevProxy.Plugins/Behavior Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,13 @@ private void FailBatch(ProxyRequestArgs e)
259259 {
260260 var retryAfterDate = DateTime . Now . AddSeconds ( Configuration . RetryAfterInSeconds ) ;
261261 var requestUrl = ProxyUtils . GetAbsoluteRequestUrlFromBatch ( e . Session . HttpClient . Request . RequestUri , request . Url ) ;
262- var throttledRequests = e . GlobalData [ RetryAfterPlugin . ThrottledRequestsKey ] as List < ThrottlerInfo > ;
262+
263+ if ( ! e . GlobalData . TryGetValue ( RetryAfterPlugin . ThrottledRequestsKey , out var value ) )
264+ {
265+ value = new List < ThrottlerInfo > ( ) ;
266+ e . GlobalData . Add ( RetryAfterPlugin . ThrottledRequestsKey , value ) ;
267+ }
268+ var throttledRequests = value as List < ThrottlerInfo > ;
263269 throttledRequests ? . Add ( new ( GraphUtils . BuildThrottleKey ( requestUrl ) , ShouldThrottle , retryAfterDate ) ) ;
264270 response . Headers = new ( ) { { "Retry-After" , Configuration . RetryAfterInSeconds . ToString ( CultureInfo . InvariantCulture ) } } ;
265271 }
You can’t perform that action at this time.
0 commit comments