Skip to content
Permalink
Browse files
Revert "[JENKINS-32190] Make UsageStatistics#isDue check Jenkins init…
… level before generating stats."

This reverts commit d8a13ac.

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 b2013ed)
  • Loading branch information
kohsuke authored and olivergondza committed Mar 30, 2016
1 parent 205cf6f commit 3a44687df5f979ea57a3206b83817c5be7299eb3
Showing with 3 additions and 7 deletions.
  1. +3 −7 core/src/main/java/hudson/model/UsageStatistics.java
@@ -31,7 +31,6 @@
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 UsageStatistics(String keyImage) {
* 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;

0 comments on commit 3a44687

Please sign in to comment.