@Override
    protected void doRun() throws Exception {
        if (!GitHubPlugin.configuration().isManageHooks()) {
            return;
        }

        URL url = GitHubPlugin.configuration().getHookUrl();

        List<Item> items = Jenkins.getInstance().getAllItems(Item.class);
        List<GitHubRepositoryName> aliveRepos = from(items)
                .filter(isAlive())  // live repos
                .transformAndConcat(associatedNames()).toList();

        while (!cleanQueue.isEmpty()) {
            GitHubRepositoryName name = cleanQueue.poll();

            WebhookManager.forHookUrl(url).unregisterFor(name, aliveRepos);
        }
    }
@ Override protected void doRun ( ) throws Exception { if ( ! GitHubPlugin . configuration ( ) . isManageHooks ( ) ) { return ; } URL url = GitHubPlugin . configuration ( ) . getHookUrl ( ) ; List < Item > items = Jenkins . getInstance ( ) . getAllItems ( Item . class ) ; List < GitHubRepositoryName > aliveRepos = from ( items ) . filter ( isAlive ( ) ) . transformAndConcat ( associatedNames ( ) ) . toList ( ) ; while ( ! cleanQueue . isEmpty ( ) ) { GitHubRepositoryName name = cleanQueue . poll ( ) ; WebhookManager . forHookUrl ( url ) . unregisterFor ( name , aliveRepos ) ; } }
Each run this work fetches alive repo names (which has trigger for it)
then if names queue is not empty (any job was reconfigured with GH trigger change),
next name passed to {@link WebhookManager} with list of active names to check and unregister old hooks