PUT fetch not able to save to database when connected to a websocket

Hi, I am building a website which has users stored in a postgres database. The rest API used to modify my user was working perfectly fine, here is what it looks like:

class UpdateUserView(APIView):
    permission_classes = [IsAuthenticated]

    def put(self, request, *args, **kwargs):
        try:
            username = request.data.get('username')

            prohibited_usernames = ["Guest", "System", "system", "guest", "admin", "Admin"]
            if username in prohibited_usernames:
                return Response(
                    {'message': 'Username not allowed'},
                    status=status.HTTP_400_BAD_REQUEST
                )

            serializer = UserSerializer(request.user, data=request.data, partial=True)
            if serializer.is_valid():
                user = serializer.save()
                send_status_update(user)
                csrf_token = get_token(request)
                print("csrf_token : ", csrf_token)
                return Response(
                    {
                        'data': serializer.data,
                        'csrfToken': csrf_token,
                        'message': 'User updated successfully'
                    },
                    status=status.HTTP_200_OK
                )
            raise ValueError(serializer.errors)
        except Exception as e:
            error_message = f"{type(e).__name__}: {str(e)}"
            return Response(
                {'message': error_message},
                status=status.HTTP_400_BAD_REQUEST

however I have added a consumer to modify the status of the user (online/offline), and the presence of the websockets made it impossible for users to modify their informations (the fetch returns 200 OK but doesn’t modify anything). I have made a few debug prints and the client does go in the if serializer.is_valid(): user = serializer.save() condition, and prints the modified version of the user. But the user isn’t changed on the database.

I tried manually stopping the status webSocket and the PUT fetch was modifying the database again. I am using daphne as a server with redis as the channels layer

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            'hosts': [('redis', 6379)],
        },
    },
}

I have been stuck on this for days, what could be causing this problem ?

here is the serializer code if needed, thank you

User = get_user_model()

class UserSerializer(serializers.ModelSerializer):
	class Meta:
		model = User
		fields = ['id', 'username', 'email', 'password', 'profile_picture', 'is_2fa_enabled', 'otp_secret', 'friends', 'status']
		read_only_fields = ['otp_secret']
		extra_kwargs = {'password': {'write_only': True}}

	def create(self, validated_data):
		username = validated_data.get('username')
		email = validated_data.get('email')
		password = validated_data.get('password')
		profile_picture = validated_data.get('profile_picture', DEFAULT_PROFILE_PICTURE)

		if not username:
			raise serializers.ValidationError({'username': 'Username is required.'})

		if not email:
			raise serializers.ValidationError({'email': 'Email is required.'})
		try:
			validate_email(email)
		except DjangoValidationError:
			raise serializers.ValidationError({'email': 'Enter a valid email address.'})

		if not password:
			raise serializers.ValidationError({'password': 'Password is required.'})
		try:
			validate_password(password)
		except DjangoValidationError as e:
			raise serializers.ValidationError({'password': list(e.messages)})

		user = User.objects.create_user(
			username=username,
			email=email,
			profile_picture=profile_picture
		)
		user.set_password(password)
		user.save()
		return user

	def update(self, instance, validated_data):
		username = validated_data.get('username')
		if username:
			if User.objects.filter(username=username).exclude(id=instance.id).exists():
				raise serializers.ValidationError({'username': 'This username is already in use.'})
			elif username == instance.username:
				raise serializers.ValidationError({'username': 'This is already your username.'})
			instance.username = username

		email = validated_data.get('email')
		if email:
			if User.objects.filter(email=email).exclude(id=instance.id).exists():
				raise serializers.ValidationError({'email': 'This email is already in use.'})
			elif email == instance.email:
				raise serializers.ValidationError({'email': 'This is already your email.'})
			instance.email = email

		password = validated_data.get('password')
		if password:
			if check_password(password, instance.password):
				raise serializers.ValidationError({'password': 'This is already your password.'})
			try:
				validate_password(password)
			except DjangoValidationError as e:
				raise serializers.ValidationError({'password': list(e.messages)})
			instance.set_password(password)

		profile_picture = validated_data.get('profile_picture')
		if profile_picture and profile_picture != instance.profile_picture:
			if instance.profile_picture != DEFAULT_PROFILE_PICTURE:
				instance.profile_picture.delete(save=False)
			instance.profile_picture = profile_picture

		instance.save()
		return instance