diff --git a/channels/adapters.py b/channels/adapters.py deleted file mode 100644 index 5e5f020..0000000 --- a/channels/adapters.py +++ /dev/null @@ -1,28 +0,0 @@ -import functools - -from django.http import HttpRequest, HttpResponse -from channels import Channel - - -def view_producer(channel_name): - """ - Returns a new view function that actually writes the request to a channel - and abandons the response (with an exception the Worker will catch) - """ - def producing_view(request): - Channel(channel_name).send(request.channel_encode()) - raise HttpResponse.ResponseLater() - return producing_view - - -def view_consumer(func): - """ - Decorates a normal Django view to be a channel consumer. - Does not run any middleware - """ - @functools.wraps(func) - def consumer(message): - request = HttpRequest.channel_decode(message.content) - response = func(request) - message.reply_channel.send(response.channel_encode()) - return func diff --git a/channels/worker.py b/channels/worker.py index 0111ff2..5195271 100644 --- a/channels/worker.py +++ b/channels/worker.py @@ -42,7 +42,5 @@ class Worker(object): self.callback(channel, message) try: consumer(message) - except Message.Requeue: - self.channel_layer.send(channel, content) except: logger.exception("Error processing message with consumer %s:", name_that_thing(consumer))