Skip to content

Commit

Permalink
🧪 Debug with _check_duration
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Feb 7, 2025
1 parent 3a80bec commit 75415b1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions acapy_agent/askar/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import asyncio
import logging
import time
import traceback
from typing import Any, Mapping, Optional
from weakref import ref

Expand Down Expand Up @@ -336,16 +337,17 @@ async def _teardown(self, commit: Optional[bool] = None):
self._check_duration()

def _check_duration(self):
# LOGGER.error(
# "release session after %.2f, acquire took %.2f",
# end - self._acquire_end,
# self._acquire_end - self._acquire_start,
# )
# end = time.perf_counter()
# if end - self._acquire_end > 1.0:
# LOGGER.error("Long session")
# traceback.print_stack(limit=5)
pass
end = time.perf_counter()
duration = end - self._acquire_end
acquire_duration = self._acquire_end - self._acquire_start

LOGGER.info(
"release session after %.2f, acquire took %.2f", duration, acquire_duration
)

if duration > 1.0:
stack = "".join(traceback.format_stack(limit=5))
LOGGER.warning("Long session:\n%s", stack)

def __del__(self):
"""Delete magic method."""
Expand Down

0 comments on commit 75415b1

Please sign in to comment.