@decorators.list_route()
    def count_history(self, request, *args, **kwargs):
        queryset = self.filter_queryset(self.get_queryset())

        mapped = {
            'start': request.query_params.get('start'),
            'end': request.query_params.get('end'),
            'points_count': request.query_params.get('points_count'),
            'point_list': request.query_params.getlist('point'),
        }
        serializer = core_serializers.HistorySerializer(data={k: v for k, v in mapped.items() if v})
        serializer.is_valid(raise_exception=True)

        timestamp_ranges = [{'end': point_date} for point_date in serializer.get_filter_data()]
        aggregated_count = queryset.aggregated_count(timestamp_ranges)

        return response.Response(
            [{'point': int(ac['end']), 'object': {'count': ac['count']}} for ac in aggregated_count],
            status=status.HTTP_200_OK)
Lock the mailbox.
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/logging/views.py/EventViewSet.count_history--crossover with--dataset/ETHPy150Open babble/babble/include/jython/Lib/mailbox.py/MH.lock