File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
localstack-core/localstack/utils/analytics Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 1
1
import datetime
2
2
import math
3
- import threading
4
3
from collections import defaultdict
4
+ from itertools import count
5
5
from typing import Any
6
6
7
7
from localstack import config
@@ -31,19 +31,18 @@ class UsageSetCounter:
31
31
"""
32
32
33
33
state : dict [str , int ]
34
+ _counter : dict [str , count ]
34
35
namespace : str
35
- _lock : threading .RLock
36
36
37
37
def __init__ (self , namespace : str ):
38
38
self .enabled = True
39
- self .state = defaultdict (int )
39
+ self .state = {}
40
+ self ._counter = defaultdict (count )
40
41
self .namespace = namespace
41
- self ._lock = threading .RLock ()
42
42
43
43
def record (self , value : str ):
44
44
if self .enabled :
45
- with self ._lock :
46
- self .state [value ] += 1
45
+ self .state [value ] = next (self ._counter [value ])
47
46
48
47
def aggregate (self ) -> dict :
49
48
return self .state
You can’t perform that action at this time.
0 commit comments