@@ -7,7 +7,7 @@ import type { ConfigurationInterface } from "./config.js";
77import { Configuration } from "./config.js" ;
88import MetricsDatabase from "./metrics/database.js" ;
99import PingsDatabase from "./pings/database.js" ;
10- import PingUploader from "./upload/index .js" ;
10+ import PingUploadManager from "./upload/manager .js" ;
1111import { isBoolean , isString , isUndefined , sanitizeApplicationId } from "./utils.js" ;
1212import { CoreMetrics } from "./internal_metrics.js" ;
1313import EventsDatabase from "./metrics/events_database/index.js" ;
@@ -39,7 +39,7 @@ class Glean {
3939 // The ping uploader. Note that we need to use the definite assignment assertion
4040 // because initialization will not happen in the constructor, but in the `initialize`
4141 // method.
42- private _pingUploader ! : PingUploader ;
42+ private _pingUploader ! : PingUploadManager ;
4343 // The Glean configuration object.
4444 private _config ! : Configuration ;
4545
@@ -62,7 +62,7 @@ class Glean {
6262 return Glean . _instance ;
6363 }
6464
65- private static get pingUploader ( ) : PingUploader {
65+ private static get pingUploader ( ) : PingUploadManager {
6666 return Glean . instance . _pingUploader ;
6767 }
6868
@@ -238,9 +238,7 @@ class Glean {
238238 Context . pingsDatabase = new PingsDatabase ( ) ;
239239 Context . errorManager = new ErrorManager ( ) ;
240240
241- Glean . instance . _pingUploader = new PingUploader ( correctConfig , Context . pingsDatabase ) ;
242-
243- Context . pingsDatabase . attachObserver ( Glean . pingUploader ) ;
241+ Glean . instance . _pingUploader = new PingUploadManager ( correctConfig , Context . pingsDatabase ) ;
244242
245243 if ( config ?. plugins ) {
246244 for ( const plugin of config . plugins ) {
@@ -460,11 +458,11 @@ class Glean {
460458 static async shutdown ( ) : Promise < void > {
461459 // Order here matters!
462460 //
463- // The main dispatcher needs to be shut down first,
464- // because some of its tasks may enqueue new tasks on the ping uploader dispatcher
461+ // The dispatcher needs to be shutdown first,
462+ // because some of its tasks may enqueue new pings to upload
465463 // and we want these uploading tasks to also be executed prior to complete shutdown.
466464 await Context . dispatcher . shutdown ( ) ;
467- await Glean . pingUploader . shutdown ( ) ;
465+ await Glean . pingUploader . blockOnOngoingUploads ( ) ;
468466 }
469467
470468 /**
0 commit comments