Use a collections.deque which has thread safe pop/append
Incase of multithreading deques are inherently safe to do pop/appends on while arrays may not be (but are likely). To ensure this use the deque which is specified to be thread safe for these operations.
This commit is contained in:
parent
3dc7c22545
commit
99c822530e
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
import collections
|
||||
import threading
|
||||
import uuid
|
||||
|
||||
@ -66,7 +66,7 @@ class Profiler(object):
|
||||
self.notifier = notifier.get_notifier()
|
||||
if not base_id:
|
||||
base_id = str(uuid.uuid4())
|
||||
self._trace_stack = [base_id, parent_id or base_id]
|
||||
self._trace_stack = collections.deque([base_id, parent_id or base_id])
|
||||
self._name = []
|
||||
|
||||
def __call__(self, name, info=None):
|
||||
|
Loading…
Reference in New Issue
Block a user