# Path: gnsq/errors.py
# class NSQException(Exception):
#     pass


import logging
import warnings
import gevent.queue
import gevent.pool
from gnsq.errors import NSQException
        self.message_channel.put(message)

        if consumer.is_starved:
            self.message_channel.put(StopIteration)

    def _run(self):
        while True:
            messages = []

            while len(messages) < self.batch_size:
                try:
                    message = self.message_channel.get(timeout=self.timeout)
                except gevent.queue.Empty:
                    warnings.warn(TIMEOUT_WARNING, RuntimeWarning)
                    break

                if message is StopIteration:
                    warnings.warn(STARVED_WARNING, RuntimeWarning)
                    break

                messages.append(message)

            if messages:
                self.spawn(self.run_batch, messages)

    def finish_message(self, message):
        if message.has_responded():
            return
        try:
            message.finish()

# Path: gnsq/errors.py
# class NSQException(Exception):
#     pass


# Path: gnsq/contrib/batch.py
import logging
import warnings
import gevent.queue
import gevent.pool
from gnsq.errors import NSQException

        self.message_channel.put(message)

        if consumer.is_starved:
            self.message_channel.put(StopIteration)

    def _run(self):
        while True:
            messages = []

            while len(messages) < self.batch_size:
                try:
                    message = self.message_channel.get(timeout=self.timeout)
                except gevent.queue.Empty:
                    warnings.warn(TIMEOUT_WARNING, RuntimeWarning)
                    break

                if message is StopIteration:
                    warnings.warn(STARVED_WARNING, RuntimeWarning)
                    break

                messages.append(message)

            if messages:
                self.spawn(self.run_batch, messages)

    def finish_message(self, message):
        if message.has_responded():
            return
        try:
            message.finish()

        except NSQException as error: