Skip to content

Commit

Permalink
Fixes #161 (#164)
Browse files Browse the repository at this point in the history
Changes logic check that evaluates the ability to retrieve pythonprofiler attribute from the local thread storage.
  • Loading branch information
perdy authored and avelis committed Mar 9, 2017
1 parent 94ad485 commit 8ece265
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions silk/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def _record_meta_profiling(self):
self.request.save()

def stop_python_profiler(self):
if hasattr(self.local, 'pythonprofiler'):
if getattr(self.local, 'pythonprofiler', None):
self.local.pythonprofiler.disable()

def finalise(self):
if hasattr(self.local, 'pythonprofiler'):
if getattr(self.local, 'pythonprofiler', None):
s = StringIO()
ps = pstats.Stats(self.local.pythonprofiler, stream=s).sort_stats('cumulative')
ps.print_stats()
Expand Down

0 comments on commit 8ece265

Please sign in to comment.