@Override
  public void start() {
    this.executorService.scheduleAtFixedRate(this::tryBroadcastEvents, getInitialDelay(), getPeriod(), TimeUnit.SECONDS);
  }
@Test
  public void broadcast_should_stop_polling_for_events_when_all_clients_unregister() {
    var project = db.components().insertPrivateProject().getMainBranchComponent();

    system2.setNow(1L);
    var sonarLintClient = mock(SonarLintClient.class);
    when(sonarLintClient.getClientProjectUuids()).thenReturn(Set.of(project.uuid()));
    when(clientsRegistry.getClients()).thenReturn(List.of(sonarLintClient), emptyList());

    var underTest = new PushEventPollScheduler(executorService, clientsRegistry, db.getDbClient(), system2, config);
    underTest.start();
    executorService.runCommand();

    verify(clientsRegistry, times(0)).broadcastMessage(any(SonarLintPushEvent.class));

    system2.tick(); // tick=2
    generatePushEvent(project.uuid());

    underTest.start();
    executorService.runCommand();

    // all clients have been unregistered, nothing to broadcast
    verify(clientsRegistry, times(0)).broadcastMessage(any(SonarLintPushEvent.class));
  }