mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 1243585 - Add short-circuits when there are no pings. r=sebastian
Ideally, we'd just not run the service but skimming, I see no clean way to do that with the existing code. MozReview-Commit-ID: HRU1PAmYoil --HG-- extra : rebase_source : 63074ae8dcd2613ff90d3f431fe2e58f51364e03
This commit is contained in:
parent
e90e46946b
commit
fb5dd484ed
@ -69,8 +69,11 @@ public class TelemetryUploadService extends IntentService {
|
||||
|
||||
private static void uploadPendingPingsFromStore(final Context context, final TelemetryPingStore store) {
|
||||
final ArrayList<TelemetryPingFromStore> pingsToUpload = store.getAllPings();
|
||||
final String serverSchemeHostPort = getServerSchemeHostPort(context);
|
||||
if (pingsToUpload.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final String serverSchemeHostPort = getServerSchemeHostPort(context);
|
||||
final HashSet<Integer> successfulUploadIDs = new HashSet<>(pingsToUpload.size()); // used for side effects.
|
||||
final PingResultDelegate delegate = new PingResultDelegate(successfulUploadIDs);
|
||||
for (final TelemetryPingFromStore ping : pingsToUpload) {
|
||||
|
@ -186,6 +186,10 @@ public class TelemetryJSONFilePingStore implements TelemetryPingStore {
|
||||
|
||||
@Override
|
||||
public void onUploadAttemptComplete(final Set<Integer> successfulRemoveIDs) {
|
||||
if (successfulRemoveIDs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final File[] files = storeDir.listFiles(new PingFileFilter(successfulRemoveIDs));
|
||||
for (final File file : files) {
|
||||
file.delete();
|
||||
|
Loading…
Reference in New Issue
Block a user