@EventListener
    @Async
    void onApplicationEvent(HaloDocumentRebuildRequestEvent event) {
        getSearchEngine()
            .doOnNext(SearchEngine::deleteAll)
            .flatMap(searchEngine -> extensionGetter.getExtensions(HaloDocumentsProvider.class)
                .flatMap(HaloDocumentsProvider::fetchAll)
                .buffer(this.bufferSize)
                .doOnNext(searchEngine::addOrUpdate)
                .then())
            .blockOptional(Duration.ofMinutes(1));
    }
@Test
    void shouldAddDocsWhenReceivingAddRequestEvent() {
        var searchEngine = mock(SearchEngine.class);
        when(searchEngine.available()).thenReturn(true);
        when(extensionGetter.getEnabledExtension(SearchEngine.class))
            .thenReturn(Mono.just(searchEngine));
        var docs = List.of(new HaloDocument());
        listener.onApplicationEvent(new HaloDocumentAddRequestEvent(this, docs));
        verify(searchEngine).addOrUpdate(docs);
    }