@@ -826,8 +826,8 @@ export class BasicCrawler<
826826 // Store whether the user explicitly provided an ID
827827 this . hasExplicitId = id !== undefined ;
828828 // Store the user-provided ID, or generate a unique one for tracking purposes (not for state key)
829- this . crawlerId = id ?? cryptoRandomObjectId ( ) ;
830829 this . crawlerInstanceIndex = BasicCrawler . instanceCount ++ ;
830+ this . crawlerId = id ?? this . crawlerInstanceIndex . toString ( ) ;
831831
832832 if ( requestManager !== undefined ) {
833833 if ( requestList !== undefined || requestQueue !== undefined ) {
@@ -885,7 +885,7 @@ export class BasicCrawler<
885885 this . stats = new Statistics ( {
886886 logMessage : `${ this . constructor . name } request statistics:` ,
887887 log : this . log ,
888- ... ( this . hasExplicitId ? { id : this . crawlerId } : { } ) ,
888+ id : this . crawlerId ,
889889 ...statisticsOptions ,
890890 } ) ;
891891
@@ -1485,8 +1485,7 @@ export class BasicCrawler<
14851485 private async openOwnedRequestQueue ( ) : Promise < IRequestManager > {
14861486 // The first crawler instance uses the default queue (null identifier);
14871487 // subsequent instances get their own queue via a unique alias so they don't collide.
1488- const identifier =
1489- this . crawlerInstanceIndex === 0 ? null : { alias : `__default_${ this . crawlerInstanceIndex } __` } ;
1488+ const identifier = this . crawlerInstanceIndex === 0 ? null : { alias : `__default_${ this . crawlerId } __` } ;
14901489
14911490 const requestQueue = await RequestQueue . open ( identifier , { config : serviceLocator . getConfiguration ( ) } ) ;
14921491 this . ownedRequestManager = requestQueue ;
0 commit comments