django / channels_redis

Redis channel layer backend for Django Channels
BSD 3-Clause "New" or "Revised" License
601 stars 197 forks source link

channel_layer.group_add with already existing group removes the group #354

Open Mauro-more opened 1 year ago

Mauro-more commented 1 year ago

I am using channels_redis as backend to GraphQL subscriptions.

Upon subscription I subscribe a user to a number of groups, which works as expected. But if in the meantime I change the subscription parameters and call group_add with a different set of groups, the groups that exist on both "previous subscription parameters" and "next subscription parameters" get deleted from channels.

Example: 
    Initial subscription parameters:
        - Group_A
        - Group_B
        - Group_C

    Final result:
        - Channels successfully subscribes to all 3 groups

    Next subscription parameters:
    - Group_A
    - Group_D

    Final result:
       - Channels subscribes only to Group_D

Is there any config to change this behaviour? Is it a bug? Did anyone experienced it?

Thanks for this awesome project.

sevdog commented 1 year ago

Which redis layer are you using, channels_redis.core.RedisChannelLayer or channels_redis.pubsub.RedisPubSubChannelLayer?

Can you provide a code snippets which reproduces your issue?