提交 0e12fe4e 编写于 作者: K Kohsuke Kawaguchi

Make data consistency self-healing.

Ryan discovered an instance where Label cached data at incorrect state. I'm not sure exactly how this is caused, but it probably is some kind of data race.

Making it self-healing would hopefully eliminate this problem in practice.
上级 9aa93663
......@@ -162,6 +162,7 @@ import hudson.tasks.BuildWrapper;
import hudson.tasks.Builder;
import hudson.tasks.Mailer;
import hudson.tasks.Publisher;
import hudson.triggers.SafeTimerTask;
import hudson.triggers.Trigger;
import hudson.triggers.TriggerDescriptor;
import hudson.util.AdministrativeError;
......@@ -184,6 +185,7 @@ import hudson.util.RemotingDiagnostics;
import hudson.util.RemotingDiagnostics.HeapDump;
import hudson.util.StreamTaskListener;
import hudson.util.TextFile;
import hudson.util.TimeUnit2;
import hudson.util.VersionNumber;
import hudson.util.XStream2;
import hudson.views.DefaultMyViewsTabBar;
......@@ -813,6 +815,13 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
}
dnsMultiCast = new DNSMultiCast(this);
Trigger.timer.scheduleAtFixedRate(new SafeTimerTask() {
@Override
protected void doRun() throws Exception {
trimLabels();
}
}, TimeUnit2.MINUTES.toMillis(5), TimeUnit2.MINUTES.toMillis(5));
updateComputerList();
{// master is online now
......@@ -1658,6 +1667,9 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
/**
* Resets all labels and remove invalid ones.
*
* This should be called when the assumptions behind label cache computation changes,
* but we also call this periodically to self-heal any data out-of-sync issue.
*/
private void trimLabels() {
for (Iterator<Label> itr = labels.values().iterator(); itr.hasNext();) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册