@Override
    public Flux<Subscriber> resolve(Reason reason) {
        var reasonType = reason.getSpec().getReasonType();
        return subscriptionService.listByPerPage(reasonType)
            .filter(this::isNotDisabled)
            .filter(subscription -> {
                var interestReason = subscription.getSpec().getReason();
                if (hasSubject(interestReason)) {
                    return subjectMatch(subscription, reason.getSpec().getSubject());
                } else if (StringUtils.isNotBlank(interestReason.getExpression())) {
                    return expressionMatch(subscription.getMetadata().getName(),
                        interestReason.getExpression(), reason);
                }
                return false;
            })
            .map(subscription -> {
                var id = UserIdentity.of(subscription.getSpec().getSubscriber().getName());
                return new Subscriber(id, subscription.getMetadata().getName());
            })
            .distinct(Subscriber::name);
    }
@Test
    void distinct() {
        // same subscriber to different subscriptions
        var subscriber = new Subscription.Subscriber();
        subscriber.setName("test");

        final var subscription1 = createSubscription(subscriber);
        subscription1.getMetadata().setName("sub-1");

        final var subscription2 = createSubscription(subscriber);
        subscription2.getMetadata().setName("sub-2");
        subscription2.getSpec().getReason().setSubject(null);
        subscription2.getSpec().getReason().setExpression("props.owner == 'guqing'");

        when(subscriptionService.listByPerPage(anyString()))
            .thenReturn(Flux.just(subscription1, subscription2));

        var reason = new Reason();
        reason.setSpec(new Reason.Spec());
        reason.getSpec().setReasonType("new-comment-on-post");
        reason.getSpec().setSubject(new Reason.Subject());
        reason.getSpec().getSubject().setApiVersion("content.halo.run/v1alpha1");
        reason.getSpec().getSubject().setKind("Post");
        reason.getSpec().getSubject().setName("fake-post");
        var reasonAttributes = new ReasonAttributes();
        reasonAttributes.put("owner", "guqing");
        reason.getSpec().setAttributes(reasonAttributes);

        recipientResolver.resolve(reason)
            .as(StepVerifier::create)
            .expectNextCount(1)
            .verifyComplete();

        verify(subscriptionService).listByPerPage(anyString());
    }