graphene-subscriptions
graphene-subscriptions copied to clipboard
Receiving updates twice per change
I am receiving updates twice per change (like a save). Everything else is working totally fine if I ignore the repetition. Is this due to some mistake in configuration from my part?

I use the following custom snippet to send update -
.
.
team.save()
event = SubscriptionEvent(
operation='TEAM_STATE_CHANGE',
instance=team
)
event.send()
I had earlier tried with post_save.connect(post_save_subscription, sender=Team, dispatch_uid="team_post_save") which also resulted in updates being dispatched twice per change/save, so I decided to try with the above custom event but it still doesn't seem to solve the issue.
This is my subscription resolver -
def resolve_teamUpdates(root, info, roomID):
return root.filter(
lambda event:
(
(
event.operation == 'TEAM_JOIN_ROOM' or
event.operation == 'TEAM_STATE_CHANGE' or
event.operation == 'TEAM_LEAVE_ROOM'
) and
isinstance(event.instance, Team) and
event.instance.room.id == int(roomID)
)
).map(lambda event: event)
Also in my django logs, I couldn't see anything surprising.

I am using a Daphne ASGI server & Django >3.0 (and react apollo in the client-side).
I'm facing the same issue. Subscription is fired twice at every single update.
facing same issue, any updates?
eventually used this https://github.com/datadvance/DjangoChannelsGraphqlWs worked like a charm and easier to set up
I also have this issue, and I receive a subscription event for every person that is subscribed. So if there are 10 subscriptions, one change occurs, every subscriber receives 10 event notifications
Bit the bullet. Updated to DjangoChannelsGraphqlWs as @ad3bay0 suggested. It's a much better library