Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-34727] Disable cache and delay branch indexing #54

Merged
merged 6 commits into from
May 13, 2016

Conversation

amuniz
Copy link
Member

@amuniz amuniz commented May 11, 2016

JENKINS-34727

Just for review, do not merge until I get a answer from GitHub support to know what's the cache expiry time so I can set up the delay more accurately.

@reviewbybees

@ghost
Copy link

ghost commented May 11, 2016

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

@jglick
Copy link
Member

jglick commented May 11, 2016

🐝 for now

}
});
}, 10, TimeUnit.SECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amuniz Could you add a comment with the Jira issue? It is easy to forget why we did this and difficult to understand for other.

Copy link
Contributor

@recena recena May 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amuniz I did not see your comment Delaying the indexing for some seconds to avoid GitHub cache

@recena
Copy link
Contributor

recena commented May 11, 2016

This hack LGTM 🐝

@amuniz
Copy link
Member Author

amuniz commented May 12, 2016

I think this introduced the issue: f0ae91d

Removing and trying.

@recena
Copy link
Contributor

recena commented May 12, 2016

@amuniz I bet for it

@amuniz
Copy link
Member Author

amuniz commented May 12, 2016

Whether disabling client cache fixes the issue or not, the delay on indexing should be kept IMO, because that delay will group burst of commits into one single build (which seems ok to me).

@KostyaSha
Copy link
Member

I think this introduced the issue: f0ae91d

;)

if (config.getClientCacheSize() > 0) {
Cache cache = toCacheDir().apply(config);
client.setCache(cache);
}
Copy link
Member

@jglick jglick May 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐜 Does this not just revert #30? Perhaps we can retain caching overall, but reset it when we receive a webhook?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverts only cache part

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick Do you think worth reset the cache each time Jenkins receives a webhook? This is something happens (or should happen) very often.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was searching for a way to invalidate the cache, but didn't find it :( Do you know how to do it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// connector...urlFactory.client().getCache().flush();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jglick We can find scenarios where they do not use webhooks but I hope you agree with me that one important feature of this plugin is just to build stuff when something happens in the source code. In this context, polling is not the most appropiate procedure.

I agree with remove the cache because the most important information from GitHub is needed in hot, without client cache.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think my point 1) was just a bad test, sorry.

Given the second point and some indications that the cache is into play in another issues (returning branches even without network connectivity as @recena noted), I think it's ok to disable the cache for now.

As there are no potential compatibility issues we can activate it again later if needed and fine tune what requests need cache and which ones not.

Copy link
Member

@KostyaSha KostyaSha May 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why github plugin configuration allows disabling it. But you are using your custom connector.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note, if (config.getClientCacheSize() > 0) { so it would be used only with positive cachesize value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why github plugin configuration allows disabling it. But you are using your custom connector.

The configuration is shared, so I guess disabling cache at configuration would disable it here too (before this PR, now there is no cache).

@aheritier aheritier closed this May 12, 2016
@aheritier aheritier reopened this May 12, 2016
}
});
},5, TimeUnit.SECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}, 5, TimeUnit.SECONDS);

@amuniz
Copy link
Member Author

amuniz commented May 13, 2016

As summary:

  1. Client cache disabled
  2. Added a delay of 5 seconds before starting a re-index when a webhook is received. I received information from GitHub support and they confirm there is a cache, but adding a 1 second delay the wrong commit issue is not reproducible, so 5 seconds put this in a safe place.

@recena
Copy link
Contributor

recena commented May 13, 2016

🐝 and 👍

@amuniz amuniz changed the title [JENKINS-34727] Delaying branch indexing [JENKINS-34727] Disable cache and delay branch indexing May 13, 2016
@recena recena merged commit 096eb38 into jenkinsci:master May 13, 2016
dubrsl pushed a commit to dubrsl/github-branch-source-plugin that referenced this pull request Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants