@@ -397,14 +397,24 @@ public async Task<int> GenerateAIReview(string reviewId, string revisionId)
397397 /// </summary>
398398 /// <param name="updateDisabledLanguages"></param>
399399 /// <param name="backgroundBatchProcessCount"></param>
400+ /// <param name="verifyUpgradabilityOnly"></param>
401+ /// <param name="packageNameFilterForUpgrade"></param>
400402 /// <returns></returns>
401- public async Task UpdateReviewsInBackground ( HashSet < string > updateDisabledLanguages , int backgroundBatchProcessCount )
403+ public async Task UpdateReviewsInBackground ( HashSet < string > updateDisabledLanguages , int backgroundBatchProcessCount , bool verifyUpgradabilityOnly , string packageNameFilterForUpgrade = "" )
402404 {
405+ // verifyUpgradabilityOnly is set when we need to run the upgrade in read only mode to recreate code files
406+ // But review code file or metadata in the DB will not be updated
407+ // This flag is set only to make sure revisions are upgradable to the latest version of the parser
408+ if ( verifyUpgradabilityOnly )
409+ {
410+ _telemetryClient . TrackTrace ( "Running background task to verify review upgradability only." ) ;
411+ }
412+
403413 foreach ( var language in LanguageService . SupportedLanguages )
404414 {
405415 if ( updateDisabledLanguages . Contains ( language ) )
406416 {
407- _telemetryClient . TrackTrace ( "Background task to update API review at startup is disabled for langauge " + language ) ;
417+ _telemetryClient . TrackTrace ( "Background task to update API review at startup is disabled for language " + language ) ;
408418 continue ;
409419 }
410420 var languageService = LanguageServiceHelpers . GetLanguageService ( language , _languageServices ) ;
@@ -414,16 +424,24 @@ public async Task UpdateReviewsInBackground(HashSet<string> updateDisabledLangua
414424 // If review is updated using devops pipeline then batch process update review requests
415425 if ( languageService . IsReviewGenByPipeline )
416426 {
417- await UpdateReviewsUsingPipeline ( language , languageService , backgroundBatchProcessCount ) ;
427+ _telemetryClient . TrackTrace ( $ "{ language } uses sandboxing pipeline to upgrade API revisions. Upgrade eligibility test is not yet supported for { language } .") ;
428+ // Do not run sandboxing based upgrade during verify upgradability only mode
429+ // This requires some changes in the pipeline to support this mode
430+ if ( ! verifyUpgradabilityOnly )
431+ {
432+ await UpdateReviewsUsingPipeline ( language , languageService , backgroundBatchProcessCount ) ;
433+ }
418434 }
419435 else
420436 {
421437 var reviews = await _reviewsRepository . GetReviewsAsync ( language : language , isClosed : false ) ;
422-
438+ if ( ! string . IsNullOrEmpty ( packageNameFilterForUpgrade ) )
439+ {
440+ reviews = reviews . Where ( r => r . PackageName == packageNameFilterForUpgrade ) ;
441+ }
423442 foreach ( var review in reviews )
424443 {
425444 var revisions = await _apiRevisionsManager . GetAPIRevisionsAsync ( review . Id ) ;
426-
427445 foreach ( var revision in revisions )
428446 {
429447 if (
@@ -434,8 +452,8 @@ public async Task UpdateReviewsInBackground(HashSet<string> updateDisabledLangua
434452 var operation = _telemetryClient . StartOperation ( requestTelemetry ) ;
435453 try
436454 {
437- await Task . Delay ( 500 ) ;
438- await _apiRevisionsManager . UpdateAPIRevisionAsync ( revision , languageService ) ;
455+ await Task . Delay ( 100 ) ;
456+ await _apiRevisionsManager . UpdateAPIRevisionAsync ( revision , languageService , verifyUpgradabilityOnly ) ;
439457 }
440458 catch ( Exception e )
441459 {
0 commit comments