11using System ;
2+ using System . Collections . Concurrent ;
23using System . Diagnostics ;
34using System . Globalization ;
45using System . Threading . Tasks ;
@@ -17,7 +18,7 @@ public class RatingPrompt
1718 {
1819 private const string _urlFormat = "https://marketplace.visualstudio.com/items?itemName={0}&ssr=false#review-details" ;
1920 private const int _minutesVisible = 2 ;
20- private static bool _hasChecked ;
21+ private static readonly ConcurrentDictionary < string , bool > _hasAlreadyRequested = new ( ) ;
2122
2223 /// <summary>
2324 /// Creates a new instance of the rating prompt.
@@ -76,9 +77,8 @@ public RatingPrompt(string marketplaceId, string extensionName, IRatingConfig co
7677 /// </summary>
7778 public virtual void RegisterSuccessfulUsage ( )
7879 {
79- if ( ! _hasChecked && Config . RatingRequests < RequestsBeforePrompt )
80+ if ( _hasAlreadyRequested . TryAdd ( MarketplaceId , true ) && Config . RatingRequests < RequestsBeforePrompt )
8081 {
81- _hasChecked = true ;
8282 IncrementAsync ( ) . FireAndForget ( ) ;
8383 }
8484 }
@@ -88,13 +88,14 @@ public virtual void RegisterSuccessfulUsage()
8888 /// </summary>
8989 public virtual async Task ResetAsync ( )
9090 {
91+ _hasAlreadyRequested . TryRemove ( MarketplaceId , out _ ) ;
9192 Config . RatingRequests = 0 ;
9293 await Config . SaveAsync ( ) ;
9394 }
9495
9596 private async Task IncrementAsync ( )
9697 {
97- await System . Threading . Tasks . Task . Yield ( ) ; // Yield to allow any shutdown procedure to continue
98+ await Task . Yield ( ) ; // Yield to allow any shutdown procedure to continue
9899
99100 if ( VsShellUtilities . ShellIsShuttingDown )
100101 {
0 commit comments