# Path: src/rest_framework_reactive/connection.py
# def get_queryobserver_settings():
#     """Query observer connection configuration."""
#     defaults = {
#         # Observers going over these limits will emit warnings.
#         'warnings': {'max_result_length': 1000, 'max_processing_time': 1.0},
#         # Observers going over these limits will be stopped.
#         'errors': {'max_processing_time': 20.0},
#         # Throttle evaluation (in seconds). If a new update comes earlier than
#         # given rate value, the evaluation will be delayed (and batched).
#         # A higher value introduces more latency.
#         'throttle_rate': 2,
#     }
#     defaults.update(getattr(settings, 'DJANGO_REST_FRAMEWORK_REACTIVE', {}))
#     return defaults


import collections
import logging
import pickle
import time
from asgiref.sync import async_to_sync
from channels.db import database_sync_to_async
from channels.layers import get_channel_layer
from django.core import exceptions as django_exceptions
from django.db import IntegrityError, connection, transaction
from django.http import Http404
from django.utils import timezone
from rest_framework import request as api_request
from . import exceptions, models
from .connection import get_queryobserver_settings
from .protocol import *
                        )
        except Http404:
            pass
        except django_exceptions.ObjectDoesNotExist:
            # The evaluation may fail when certain dependent objects (like users) are removed
            # from the database. In this case, the observer is stopped.
            pass

        return results

    def _evaluate(self, viewset_results=None):
        """Evaluate query observer.

        :param viewset_results: Objects returned by the viewset query
        """
        if viewset_results is None:
            viewset_results = self._viewset_results()

        try:
            observer = models.Observer.objects.get(id=self.id)
            # Do not evaluate the observer if there are no subscribers
            if observer.subscribers.count() == 0:
                return (None, None, None)

            # Update last evaluation time.
            models.Observer.objects.filter(id=self.id).update(
                last_evaluation=timezone.now()
            )

            # Log viewsets with too much output.

# Path: src/rest_framework_reactive/connection.py
# def get_queryobserver_settings():
#     """Query observer connection configuration."""
#     defaults = {
#         # Observers going over these limits will emit warnings.
#         'warnings': {'max_result_length': 1000, 'max_processing_time': 1.0},
#         # Observers going over these limits will be stopped.
#         'errors': {'max_processing_time': 20.0},
#         # Throttle evaluation (in seconds). If a new update comes earlier than
#         # given rate value, the evaluation will be delayed (and batched).
#         # A higher value introduces more latency.
#         'throttle_rate': 2,
#     }
#     defaults.update(getattr(settings, 'DJANGO_REST_FRAMEWORK_REACTIVE', {}))
#     return defaults


# Path: src/rest_framework_reactive/observer.py
import collections
import logging
import pickle
import time
from asgiref.sync import async_to_sync
from channels.db import database_sync_to_async
from channels.layers import get_channel_layer
from django.core import exceptions as django_exceptions
from django.db import IntegrityError, connection, transaction
from django.http import Http404
from django.utils import timezone
from rest_framework import request as api_request
from . import exceptions, models
from .connection import get_queryobserver_settings
from .protocol import *

                        )
        except Http404:
            pass
        except django_exceptions.ObjectDoesNotExist:
            # The evaluation may fail when certain dependent objects (like users) are removed
            # from the database. In this case, the observer is stopped.
            pass

        return results

    def _evaluate(self, viewset_results=None):
        """Evaluate query observer.

        :param viewset_results: Objects returned by the viewset query
        """
        if viewset_results is None:
            viewset_results = self._viewset_results()

        try:
            observer = models.Observer.objects.get(id=self.id)
            # Do not evaluate the observer if there are no subscribers
            if observer.subscribers.count() == 0:
                return (None, None, None)

            # Update last evaluation time.
            models.Observer.objects.filter(id=self.id).update(
                last_evaluation=timezone.now()
            )

            # Log viewsets with too much output.

            max_result = get_queryobserver_settings()['warnings']['max_result_length']