Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorentinD committed Jan 29, 2025
1 parent 6cc7fe2 commit bed0dc7
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions graphdatascience/query_runner/protocol/retry_utils.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
import logging
import signal
import typing
from types import FrameType
from typing import Optional

from tenacity import RetryCallState, retry_base


class retry_unless_signal(retry_base):
"""Retries unless one of the given signals is raised."""

def __init__(self, signals: list[signal.Signals]) -> None:
self.signal_received = False

def receive_signal(sig: int, frame: Optional[FrameType]) -> None:
logging.debug(f"Received signal {sig}. Interrupting retry.")
self.signal_received = True

try:
for sig in signals:
signal.signal(sig, receive_signal)
except ValueError as e:
# signal.signal() can raise ValueError if this is not called in the main thread (such as when an algorithm is called in a ThreadPool)
logging.debug(f"Cannot set signal handler for retries {e}")

def __call__(self, retry_state: RetryCallState) -> bool:
return not self.signal_received
from tenacity import RetryCallState


def before_log(
Expand Down

0 comments on commit bed0dc7

Please sign in to comment.