Skip to content
Snippets Groups Projects
Commit f1452db3 authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/main/145' into 'main'

Iss #145 - Add configurable frequency for GH revalidation, fix count

See merge request !159
parents b37e5958 524e0ca4
No related branches found
No related tags found
1 merge request!159Iss #145 - Add configurable frequency for GH revalidation, fix count
Pipeline #31909 passed
......@@ -75,7 +75,7 @@ public class GithubRevalidationQueue {
* Every 5s, this method will attempt to load a Github webhook validation request that has the needs revalidation flag
* set to true. This will retrieve the oldest request in queue and will attempt to revalidate it.
*/
@Scheduled(every = "5s")
@Scheduled(every = "${eclipse.git-eca.tasks.gh-revalidation.frequency:60s}")
@ActivateRequestContext
public void revalidate() {
// if not enabled, don't process any potentially OOD records
......@@ -114,6 +114,10 @@ public class GithubRevalidationQueue {
.debug("Attempting revalidation of request w/ ID {}, in repo {}#{}", requestToRevalidate.getId(),
requestToRevalidate.getRepositoryFullName(), requestToRevalidate.getPullRequestNumber());
// update the number of times this status has revalidated (tracking)
requestToRevalidate
.setManualRevalidationCount(requestToRevalidate.getManualRevalidationCount() == null ? 1
: requestToRevalidate.getManualRevalidationCount() + 1);
// wrap in try-catch to avoid errors from stopping the record updates
try {
// split the full repo name into the org and repo name
......@@ -130,10 +134,6 @@ public class GithubRevalidationQueue {
requestToRevalidate.setNeedsRevalidation(false);
LOGGER.debug("Sucessfully revalidated request w/ ID {}", requestToRevalidate.getId());
} catch (RuntimeException e) {
// update the number of times this status has revalidated (tracking)
requestToRevalidate
.setManualRevalidationCount(requestToRevalidate.getManualRevalidationCount() == null ? 1
: requestToRevalidate.getManualRevalidationCount() + 1);
// log the message so we can see what happened
LOGGER.error("Error while revalidating request w/ ID {}", requestToRevalidate.getId(), e);
} finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment