@@ -561,7 +561,7 @@ export class Crawler {
561561 this . seeds = await parseSeeds ( this . downloadsDir , this . params ) ;
562562 this . numOriginalSeeds = this . seeds . length ;
563563
564- logger . info ( "Seeds" , this . seeds ) ;
564+ logger . info ( "Num Original Seeds" , { numSeeds : this . numOriginalSeeds } ) ;
565565
566566 logger . info ( "Link Selectors" , this . params . selectLinks ) ;
567567
@@ -659,46 +659,51 @@ export class Crawler {
659659 async run ( ) {
660660 await this . bootstrap ( ) ;
661661
662- let status : CrawlStatus = "done " ;
663- let exitCode = ExitCodes . Success ;
662+ let status : CrawlStatus = "interrupted " ;
663+ let exitCode = ExitCodes . GenericError ;
664664
665665 try {
666666 await this . crawl ( ) ;
667+
667668 const finished = await this . crawlState . isFinished ( ) ;
668669 const stopped = await this . crawlState . isCrawlStopped ( ) ;
669670 const canceled = await this . crawlState . isCrawlCanceled ( ) ;
670- if ( ! finished ) {
671- if ( canceled ) {
672- status = "canceled" ;
673- await this . cleanupOnCancel ( ) ;
674- } else if ( stopped ) {
675- status = "done" ;
676- logger . info ( "Crawl gracefully stopped on request" ) ;
677- } else if ( this . interruptReason ) {
678- status = "interrupted" ;
679- switch ( this . interruptReason ) {
680- case InterruptReason . SizeLimit :
681- exitCode = ExitCodes . SizeLimit ;
682- break ;
683- case InterruptReason . BrowserCrashed :
684- exitCode = ExitCodes . BrowserCrashed ;
685- break ;
686- case InterruptReason . SignalInterrupted :
687- exitCode = ExitCodes . SignalInterrupted ;
688- break ;
689- case InterruptReason . DiskUtilization :
690- exitCode = ExitCodes . DiskUtilization ;
691- break ;
692- case InterruptReason . FailedLimit :
693- exitCode = ExitCodes . FailedLimit ;
694- break ;
695- case InterruptReason . TimeLimit :
696- exitCode = ExitCodes . TimeLimit ;
697- break ;
698- case InterruptReason . RateLimited :
699- exitCode = ExitCodes . RateLimited ;
700- break ;
701- }
671+ if ( finished ) {
672+ status = "done" ;
673+ } else if ( stopped ) {
674+ status = "done" ;
675+ logger . info ( "Crawl gracefully stopped on request" ) ;
676+ } else if ( canceled ) {
677+ status = "canceled" ;
678+ await this . cleanupOnCancel ( ) ;
679+ } else if ( this . interruptReason ) {
680+ status = "interrupted" ;
681+ switch ( this . interruptReason ) {
682+ case InterruptReason . SizeLimit :
683+ exitCode = ExitCodes . SizeLimit ;
684+ break ;
685+ case InterruptReason . BrowserCrashed :
686+ exitCode = ExitCodes . BrowserCrashed ;
687+ break ;
688+ case InterruptReason . SignalInterrupted :
689+ exitCode = ExitCodes . SignalInterrupted ;
690+ break ;
691+ case InterruptReason . DiskUtilization :
692+ exitCode = ExitCodes . DiskUtilization ;
693+ break ;
694+ case InterruptReason . FailedLimit :
695+ exitCode = ExitCodes . FailedLimit ;
696+ break ;
697+ case InterruptReason . TimeLimit :
698+ exitCode = ExitCodes . TimeLimit ;
699+ break ;
700+ case InterruptReason . RateLimited :
701+ exitCode = ExitCodes . RateLimited ;
702+ break ;
703+ case InterruptReason . CrawlPaused :
704+ status = "done" ;
705+ exitCode = ExitCodes . Success ;
706+ break ;
702707 }
703708 }
704709 if ( await this . crawlState . isFailed ( ) ) {
@@ -2263,6 +2268,8 @@ self.__bx_behaviors.selectMainBehavior();
22632268 const targetFilename = await this . crawlState . getWACZFilename ( ) ;
22642269
22652270 await this . storage . uploadCollWACZ ( wacz , targetFilename , isFinished ) ;
2271+
2272+ this . uploadAndDeleteLocal = true ;
22662273 }
22672274 return wacz ;
22682275 } catch ( e ) {
@@ -2304,12 +2311,14 @@ self.__bx_behaviors.selectMainBehavior();
23042311 const crawled = await this . crawlState . numDone ( ) ;
23052312 const failed = await this . crawlState . numFailed ( ) ;
23062313 const total = await this . crawlState . numFound ( ) ;
2314+ const excluded = await this . crawlState . numExcluded ( ) ;
23072315 const limit = { max : this . pageLimit || 0 , hit : this . limitHit } ;
23082316 const stats = {
23092317 crawled,
23102318 total,
23112319 pending,
23122320 failed,
2321+ excluded,
23132322 limit,
23142323 pendingPages,
23152324 } ;
0 commit comments