提交 ce866ddb 编写于 作者: K Kohsuke Kawaguchi 提交者: Oliver Gondža

Revert "[JENKINS-32190] Make UsageStatistics#isDue check Jenkins init level...

Revert "[JENKINS-32190] Make UsageStatistics#isDue check Jenkins init level before generating stats."

This reverts commit d8a13ac0.

I noticed a strange drop in usage statistics from the mid Jan 2016,
which corresponds to the time this change was released in the wild,
and further drop when LTS 1.642.2 is released with this change at
the end of Feb.

I spent some time trying to determine how this might cause instances
to stop sending data, but I couldn't come up with any. I left those
notes in JENKINS-32190. There was some strange behaviours, but none
explains what this is.

So I'd like to back out this change and see if that makes any impact
on the stats collection. If it backs up, then we know empirically
this change is to blame, so that would justify spending further
effort or come up with a fix from a different angle.

(cherry picked from commit b2013edb)
上级 9ea9761a
......@@ -31,7 +31,6 @@ import hudson.node_monitors.ArchitectureMonitor.DescriptorImpl;
import hudson.util.IOUtils;
import hudson.util.Secret;
import static hudson.util.TimeUnit2.DAYS;
import static hudson.init.InitMilestone.COMPLETED;
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;
......@@ -96,12 +95,9 @@ public class UsageStatistics extends PageDecorator {
* Returns true if it's time for us to check for new version.
*/
public boolean isDue() {
final Jenkins j = Jenkins.getInstance();
// user opted out or Jenkins not fully initialized. no data collection.
if (j == null || j.isUsageStatisticsCollected() || DISABLED || COMPLETED.compareTo(j.getInitLevel()) > 0) {
return false;
}
// user opted out. no data collection.
if(!Jenkins.getInstance().isUsageStatisticsCollected() || DISABLED) return false;
long now = System.currentTimeMillis();
if(now - lastAttempt > DAY) {
lastAttempt = now;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册