Remove dead code

This commit is contained in:
Andrew Godwin 2016-02-09 12:59:24 -08:00
parent e575693093
commit 5ddeed4a25
2 changed files with 0 additions and 30 deletions

View File

@ -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

View File

@ -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))