Skip to content

Commit dc353f1

Browse files
authored
Ensure only empty pings triggers logging of "empty ping" message (#279) (#279)
1 parent 6b35e1c commit dc353f1

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.11.0...main)
44

5+
* [#279](https://github.com/mozilla/glean.js/pull/279): BUGFIX: Ensure only empty pings triggers logging of "empty ping" messages.
6+
57
# v0.11.0 (2021-05-03)
68

79
[Full changelog](https://github.com/mozilla/glean.js/compare/v0.10.2...v0.11.0)

glean/src/core/pings/maker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,11 @@ export function getPingHeaders(debugOptions?: DebugOptions): Record<string, stri
195195
export async function collectPing(metricsDatabase: MetricsDatabase, eventsDatabase: EventsDatabase, ping: CommonPingData, reason?: string): Promise<PingPayload | undefined> {
196196
const metricsData = await metricsDatabase.getPingMetrics(ping.name, true);
197197
const eventsData = await eventsDatabase.getPingEvents(ping.name, true);
198-
if (!metricsData && !eventsData && !ping.sendIfEmpty) {
199-
console.info(`Storage for ${ping.name} empty. Bailing out.`);
200-
return;
201-
} else if (!metricsData) {
198+
if (!metricsData && !eventsData) {
199+
if (!ping.sendIfEmpty) {
200+
console.info(`Storage for ${ping.name} empty. Bailing out.`);
201+
return;
202+
}
202203
console.info(`Storage for ${ping.name} empty. Ping will still be sent.`);
203204
}
204205

0 commit comments

Comments
 (0)