File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,6 +102,16 @@ export const navigateToFlatPage =
102102 ) ;
103103 const flatTitleSelector = entryTitleSelector ( flatId ) ;
104104
105+ if ( ! ( await puppetView . elementExists ( flatTitleSelector ) ) ) {
106+ logger . warn (
107+ `Current flat with flatTitleSelector='${ flatTitleSelector } ' could not be found!`
108+ ) ;
109+ logger . warn ( `url:${ puppetView . getURL ( ) } ` ) ;
110+ dispatch ( setBotMessage ( `Fehler: Wohnung ${ flatId } nicht gefunden...` ) ) ;
111+ await sleep ( 5000 ) ;
112+ return false ;
113+ }
114+
105115 /* eslint-disable no-await-in-loop */
106116 while ( AbortionSystem . nestedFunctionsMayContinue ) {
107117 if ( ! ( await puppetView . elementExists ( flatTitleSelector ) ) ) {
Original file line number Diff line number Diff line change 11import type { Action , Dispatch , Store } from '../reducers/types' ;
22import { LAUNCH_NEXT_TASK } from '../constants/actionTypes' ;
3- import { navigateToFlatPage , noop , returnToSearchPage } from '../actions/bot' ;
3+ import {
4+ navigateToFlatPage ,
5+ noop ,
6+ returnToSearchPage ,
7+ popFlatFromQueue
8+ } from '../actions/bot' ;
9+ import { markCompleted } from '../actions/cache' ;
410import type { schedulerStateType } from '../reducers/scheduler' ;
11+ import { CacheNames } from '../reducers/cache' ;
512import type { dataStateType } from '../reducers/data' ;
613import { endApplicationProcess } from '../actions/application' ;
714import { logger } from '../utils/tracer-logger.js' ;
@@ -52,6 +59,15 @@ export default (store: Store & { dispatch: Dispatch }) =>
5259 if ( ! reachedFlatPage ) {
5360 // eslint-disable-next-line no-console
5461 logger . error ( `Flat page wasn't reached, aborting task.` ) ;
62+ await store . dispatch ( popFlatFromQueue ( nextFlatId ) ) ;
63+ await store . dispatch (
64+ markCompleted ( CacheNames . APPLICATIONS , nextFlatId , {
65+ flatId : nextFlatId ,
66+ success : false ,
67+ addressDescription : '' ,
68+ reason : 'Flat not found'
69+ } )
70+ ) ;
5571 store . dispatch ( endApplicationProcess ( ) ) ;
5672 }
5773
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ ${this.webContents.getURL()}`);
6363 . includes ( 'immobilienscout24.de' ) ;
6464 }
6565
66+ getURL ( ) : string {
67+ return this . webContents . getURL ( ) ;
68+ }
69+
6670 static generateSelector (
6771 selector : string ,
6872 shadowRootSelector ?: string
You can’t perform that action at this time.
0 commit comments