<commit_before>from Queue import Queue
from sentry.client.base import SentryClient
from threading import Thread, Lock

class SentryAsyncClient(SentryClient):
    """This client uses a single background thread to dispatch errors."""
    _terminator = object()

    def __init__(self):
        """Starts the task thread."""
        self.queue = Queue(-1)
        self._lock = Lock()
        self._thread = None
        self.start()

    def start(self):
        self._lock.acquire()
        try:
            if not self._thread:
                self._thread = Thread(target=self._target)
                self._thread.setDaemon(False)
                self._thread.start()
        finally:
            self._lock.release()

    def stop(self):
        """Stops the task thread. Synchronous!"""
        self._lock.acquire()
        try:
            if self._thread:
                self.queue.put_nowait(self._terminator)
                self._thread.join()
                self._thread = None
        finally:
            self._lock.release()

    def _target(self):
        while 1:
            record = self.queue.get()
            if record is self._terminator:
                break
            self.send_remote_sync(**record)

    def send_remote_sync(self, **kwargs):
        super(SentryAsyncClient, self).send_remote(**kwargs)

    def send_remote(self, **kwargs):
        self.queue.put_nowait(kwargs)<commit_msg>Ensure the Async client is calling the correct super method<commit_after>from Queue import Queue
from sentry.client.base import SentryClient
from threading import Thread, Lock

class SentryAsyncClient(SentryClient):
    """This client uses a single background thread to dispatch errors."""
    _terminator = object()

    def __init__(self):
        """Starts the task thread."""
        self.queue = Queue(-1)
        self._lock = Lock()
        self._thread = None
        self.start()

    def start(self):
        self._lock.acquire()
        try:
            if not self._thread:
                self._thread = Thread(target=self._target)
                self._thread.setDaemon(False)
                self._thread.start()
        finally:
            self._lock.release()

    def stop(self):
        """Stops the task thread. Synchronous!"""
        self._lock.acquire()
        try:
            if self._thread:
                self.queue.put_nowait(self._terminator)
                self._thread.join()
                self._thread = None
        finally:
            self._lock.release()

    def _target(self):
        while 1:
            record = self.queue.get()
            if record is self._terminator:
                break
            self.send_remote_sync(**record)

    def send_sync(self, **kwargs):
        super(SentryAsyncClient, self).send(**kwargs)

    def send(self, **kwargs):
        self.queue.put_nowait(kwargs)
{'fraction_non_alphanumeric': 0.10206221600838868, 'fraction_numerical': 0.0013981125480601187, 'mean_word_length': 1.8850806451612903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '318232', 'n_tokens_mistral': 795, 'n_tokens_neox': 766, 'n_words': 190}