File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed
Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change 55using LootLocker . LootLockerEnums ;
66using LootLocker . Requests ;
77using Newtonsoft . Json . Serialization ;
8+ using UnityEditor ;
89
910
1011// using LootLocker.Admin;
@@ -279,10 +280,31 @@ protected int GetMaxRequestsInSingleBucket()
279280 return maxRequests ;
280281 }
281282
282- private static readonly RateLimiter _rateLimiter = new RateLimiter ( ) ;
283- public static RateLimiter Get ( ) { return _rateLimiter ; }
284- }
283+ private static RateLimiter _rateLimiter = null ;
284+
285+ public static RateLimiter Get ( )
286+ {
287+ if ( _rateLimiter == null )
288+ {
289+ Reset ( ) ;
290+ }
291+ return _rateLimiter ;
292+ }
293+
294+ public static void Reset ( )
295+ {
296+ _rateLimiter = new RateLimiter ( ) ;
297+ }
285298
299+ #if UNITY_EDITOR
300+ [ InitializeOnEnterPlayMode ]
301+ static void OnEnterPlaymodeInEditor ( EnterPlayModeOptions options )
302+ {
303+ LootLockerLogger . GetForLogLevel ( ) ( "Reset RateLimiter due to entering play mode" ) ;
304+ Reset ( ) ;
305+ }
306+ #endif
307+ }
286308 #endregion
287309
288310 /// <summary>
You can’t perform that action at this time.
0 commit comments