Skip to content

Commit cfc709e

Browse files
committed
Use ThreadCollector
1 parent 228e19c commit cfc709e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

debug_toolbar/panels/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from debug_toolbar.utils.function_wrapper import FunctionWrapper
1111
from debug_toolbar.utils.imports import get_name_from_obj
1212
from debug_toolbar.utils.patch_context import PatchContext
13+
from debug_toolbar.utils.thread_collector import ThreadCollector
1314

1415

1516
class Panel(object):
@@ -180,12 +181,16 @@ def __init__(self, *args, **kwargs):
180181
class CallRecordingPanel(Panel):
181182
def __init__(self, *args, **kwargs):
182183
super(CallRecordingPanel, self).__init__(*args, **kwargs)
183-
self.calls = []
184+
self._collector = ThreadCollector()
184185
self._context = []
185186

186187
for context in self.get_context():
187188
self.add_context(context)
188189

190+
@property
191+
def calls(self):
192+
return self._collector.get_collection()
193+
189194
def get_context(self):
190195
"""
191196
>>> def get_context(self):
@@ -206,6 +211,8 @@ def disable_instrumentation(self):
206211
for context in self._context:
207212
context.unpatch()
208213

214+
self._collector.clear_collection()
215+
209216
@property
210217
def nav_subtitle(self):
211218
calls = len(self.calls)

0 commit comments

Comments
 (0)