Re: Channels v2.0 - 'RedisChannelLayer' object has no attribute 'ChannelFull'

2018-02-04 Thread Andrew Godwin
Hi,

Sorry about this, it was a bug in the group_send method. It's been fixed in
channels_redis version 2.0.2.

Andrew

On Sun, Feb 4, 2018 at 4:19 AM, Ahmed Magdy  wrote:

> Sending 10~12 messages to the websocket raises an exception
>
> 'RedisChannelLayer' object has no attribute 'ChannelFull'
>>
>
> Trace
>
> ERROR:root:Exception inside application: 'RedisChannelLayer' object has no
>> attribute 'ChannelFull'
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-
>> packages\channels\consumer.py", line 51, in __call__
>> await await_many_dispatch([receive, self.channel_receive],
>> self.dispatch)
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels\utils.py",
>> line 48, in await_many_dispatch
>> await dispatch(result)
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 99, in inner
>> return await async_func(*args, **kwargs)
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 79, in __call__
>> return await asyncio.wait_for(future, timeout=None)
>>   File "C:\Python36\lib\asyncio\tasks.py", line 339, in wait_for
>> return (yield from fut)
>>   File "C:\Python36\lib\concurrent\futures\thread.py", line 56, in run
>> result = self.fn(*self.args, **self.kwargs)
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 91, in thread_handler
>> raise e
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 89, in thread_handler
>> self.func(*args, **kwargs)
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-
>> packages\channels\consumer.py", line 93, in dispatch
>> handler(message)
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-
>> packages\channels\generic\websocket.py", line 40, in websocket_receive
>> self.receive(text_data=message["text"])
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\husite\
>> GraduationProject\sessionManagerApp\consumers.py", line 28, in receive
>> self.send_message('[{0}] {1}'.format(self.get_user_fullname(),
>> text_data))
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\husite\
>> GraduationProject\sessionManagerApp\consumers.py", line 36, in
>> send_message
>> "text": text_data,
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 45, in __call__
>> call_result.result()
>>   File "C:\Python36\lib\concurrent\futures\_base.py", line 432, in result
>> return self.__get_result()
>>   File "C:\Python36\lib\concurrent\futures\_base.py", line 384, in
>> __get_result
>> raise self._exception
>>   File 
>> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>> line 53, in main_wrap
>> result = await self.awaitable(*args, **kwargs)
>>   File "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-
>> packages\channels_redis\core.py", line 326, in group_send
>> except self.ChannelFull:
>>   'RedisChannelLayer' object has no attribute 'ChannelFull'
>>
>
> Here's the function that raises the exception.
>
> def send_message(self, text_data):
>session_id = self.scope['url_route']['kwargs']['session_id']
>AsyncToSync(self.channel_layer.group_send)(
>'chat-{0}'.format(session_id),
>{
>"type": "chat.message",
>"text": text_data,
>},
>)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/e05542a0-43e1-42ec-bc92-6861565f5e91%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFwN1uqVXbWZKjyuX19CO6SytWuCWPrE0-HPWtqsWz9nFqDgww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Channels v2.0 - 'RedisChannelLayer' object has no attribute 'ChannelFull'

2018-02-04 Thread Ahmed Magdy
Sending 10~12 messages to the websocket raises an exception

'RedisChannelLayer' object has no attribute 'ChannelFull'
>

Trace

ERROR:root:Exception inside application: 'RedisChannelLayer' object has no 
> attribute 'ChannelFull'
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels\consumer.py",
>  
> line 51, in __call__
> await await_many_dispatch([receive, self.channel_receive], 
> self.dispatch)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels\utils.py",
>  
> line 48, in await_many_dispatch
> await dispatch(result)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 99, in inner
> return await async_func(*args, **kwargs)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 79, in __call__
> return await asyncio.wait_for(future, timeout=None)
>   File "C:\Python36\lib\asyncio\tasks.py", line 339, in wait_for
> return (yield from fut)
>   File "C:\Python36\lib\concurrent\futures\thread.py", line 56, in run
> result = self.fn(*self.args, **self.kwargs)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 91, in thread_handler
> raise e
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 89, in thread_handler
> self.func(*args, **kwargs)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels\consumer.py",
>  
> line 93, in dispatch
> handler(message)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels\generic\websocket.py",
>  
> line 40, in websocket_receive
> self.receive(text_data=message["text"])
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\husite\GraduationProject\sessionManagerApp\consumers.py",
>  
> line 28, in receive
> self.send_message('[{0}] {1}'.format(self.get_user_fullname(), 
> text_data))
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\husite\GraduationProject\sessionManagerApp\consumers.py",
>  
> line 36, in send_message
> "text": text_data,
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 45, in __call__
> call_result.result()
>   File "C:\Python36\lib\concurrent\futures\_base.py", line 432, in result
> return self.__get_result()
>   File "C:\Python36\lib\concurrent\futures\_base.py", line 384, in 
> __get_result
> raise self._exception
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\asgiref\sync.py",
>  
> line 53, in main_wrap
> result = await self.awaitable(*args, **kwargs)
>   File 
> "D:\Programming\DjangoWebsite\MigratingHUsite\lib\site-packages\channels_redis\core.py",
>  
> line 326, in group_send
> except self.ChannelFull:
>   'RedisChannelLayer' object has no attribute 'ChannelFull'
>

Here's the function that raises the exception.

def send_message(self, text_data):
   session_id = self.scope['url_route']['kwargs']['session_id']
   AsyncToSync(self.channel_layer.group_send)(
   'chat-{0}'.format(session_id),
   {
   "type": "chat.message",
   "text": text_data,
   },
   )

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e05542a0-43e1-42ec-bc92-6861565f5e91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.