jenkinsci / generic-webhook-trigger-plugin

Can receive any HTTP request, extract any values from JSON or XML and trigger a job with those values available as variables. Works with GitHub, GitLab, Bitbucket, Jira and many more.
https://plugins.jenkins.io/generic-webhook-trigger
410 stars 162 forks source link

Possible to clear cache on demand? #308

Closed ntfc closed 6 months ago

ntfc commented 6 months ago

Explain your issue

Hello,

First of all, thanks a lot for the plugin as it has greatly helped in setting up a more general webhook handling system!

However one limitation we run into is that once a job is created or configured to use this plugin it takes a long time to start processing webhooks (unless Jenkins is restarted). I understand this is related to some internal caching as explained in https://github.com/jenkinsci/generic-webhook-trigger-plugin?tab=readme-ov-file#cache-jobs

Is there a way to manually or programmatically clear this cache, or to define a shorter TTL?

Thank you!

tomasbjerre commented 6 months ago

What version of the plugin do you use?

ntfc commented 6 months ago

Sorry to not include that, using Jenkins 2.456 and plugin 2.2.0

tomasbjerre commented 6 months ago

The way I interpret "takes a long time to start processing webhooks " it sounds like the behavior prior to 2.2.0.

You mean that any request to the plugin will give you 404 and after a "long time" it starts responding with 200?

ntfc commented 6 months ago

I meant the plugin was returning 200 but the job itself was not part of the response.

But you're totally right, it works perfectly! I was probably looking at the wrong jobs last night 🙈 Just tried setting a new job and it immediately started processing webhook requests.

Thank you and sorry for the wasted time!