Skip to content
This repository has been archived by the owner on Apr 25, 2018. It is now read-only.

Commit

Permalink
Do not store events if collection is disabled. (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo committed May 12, 2017
1 parent 2950124 commit 9f1e791
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions telemetry/src/main/java/org/mozilla/telemetry/Telemetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ public Telemetry addPingBuilder(TelemetryPingBuilder builder) {
}

public Telemetry queuePing(final String pingType) {
if (!configuration.isCollectionEnabled()) {
return this;
}

executor.submit(new Runnable() {
@Override
public void run() {
if (!configuration.isCollectionEnabled()) {
return;
}

final TelemetryPingBuilder pingBuilder = pingBuilders.get(pingType);

if (!pingBuilder.canBuild()) {
Expand All @@ -76,6 +76,10 @@ public void run() {
}

public Telemetry queueEvent(final TelemetryEvent event) {
if (!configuration.isCollectionEnabled()) {
return this;
}

executor.submit(new Runnable() {
@Override
public void run() {
Expand All @@ -93,22 +97,18 @@ public void run() {
return this;
}

public TelemetryPingBuilder getBuilder(String pingType) {
return pingBuilders.get(pingType);
}

public Collection<TelemetryPingBuilder> getBuilders() {
return pingBuilders.values();
}

public Telemetry scheduleUpload() {
if (!configuration.isUploadEnabled()) {
return this;
}

executor.submit(new Runnable() {
@Override
public void run() {
if (!configuration.isUploadEnabled()) {
return;
}

scheduler.scheduleUpload(configuration);
}
});
Expand Down

0 comments on commit 9f1e791

Please sign in to comment.