@@ -32,7 +32,6 @@ import { RequestHandler, RequestInfo } from './requestinfo';
3232import { isJustDef } from './type' ;
3333import { makeQueryString } from './url' ;
3434import { Headers , Connection , ErrorCode } from './connection' ;
35- import { ConnectionPool } from './connectionPool' ;
3635
3736export interface Request < T > {
3837 getPromise ( ) : Promise < T > ;
@@ -68,7 +67,7 @@ class NetworkRequest<T> implements Request<T> {
6867 private errorCallback_ : RequestHandler < StorageError , StorageError > | null ,
6968 private timeout_ : number ,
7069 private progressCallback_ : ( ( p1 : number , p2 : number ) => void ) | null ,
71- private pool_ : ConnectionPool
70+ private connectionFactory_ : ( ) => Connection
7271 ) {
7372 this . promise_ = new Promise ( ( resolve , reject ) => {
7473 this . resolve_ = resolve as ( value ?: T | PromiseLike < T > ) => void ;
@@ -89,7 +88,7 @@ class NetworkRequest<T> implements Request<T> {
8988 backoffCallback ( false , new RequestEndStatus ( false , null , true ) ) ;
9089 return ;
9190 }
92- const connection = this . pool_ . createConnection ( ) ;
91+ const connection = this . connectionFactory_ ( ) ;
9392 this . pendingConnection_ = connection ;
9493
9594 const progressListener : ( progressEvent : ProgressEvent ) => void =
@@ -272,7 +271,7 @@ export function makeRequest<T>(
272271 appId : string | null ,
273272 authToken : string | null ,
274273 appCheckToken : string | null ,
275- pool : ConnectionPool ,
274+ requestFactory : ( ) => Connection ,
276275 firebaseVersion ?: string
277276) : Request < T > {
278277 const queryPart = makeQueryString ( requestInfo . urlParams ) ;
@@ -293,6 +292,6 @@ export function makeRequest<T>(
293292 requestInfo . errorHandler ,
294293 requestInfo . timeout ,
295294 requestInfo . progressCallback ,
296- pool
295+ requestFactory
297296 ) ;
298297}
0 commit comments