Skip to content

Commit 91b2586

Browse files
committed
Increase timeouts on waitFor
1 parent 7abcd0c commit 91b2586

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/shopping_carts/farnell/index.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async function getCartIds(site): Promise<Array<string> | null> {
9494
console.log('inputs is null:', inputs == null)
9595
return inputs
9696
},
97+
{ timeoutMs: 60_000 },
9798
).catch(e => {
9899
// timed out?
99100
console.error('getCartIds:')
@@ -117,15 +118,18 @@ async function getCartIds(site): Promise<Array<string> | null> {
117118

118119
function getStoreId(site): Promise<string | null> {
119120
const url = `${site}/webapp/wcs/stores/servlet/AjaxOrderItemDisplayView`
120-
return waitFor(async () => {
121-
const text = await fetchRetry(url).then(res => res.text())
122-
console.log('text')
123-
const doc = new DOMParser().parseFromString(text, 'text/html')
124-
console.log('doc')
125-
const elem = doc.getElementById('storeId') as HTMLInputElement
126-
console.log('elem is null:', elem == null)
127-
return elem?.value
128-
}).catch(e => {
121+
return waitFor(
122+
async () => {
123+
const text = await fetchRetry(url).then(res => res.text())
124+
console.log('text')
125+
const doc = new DOMParser().parseFromString(text, 'text/html')
126+
console.log('doc')
127+
const elem = doc.getElementById('storeId') as HTMLInputElement
128+
console.log('elem is null:', elem == null)
129+
return elem?.value
130+
},
131+
{ timeoutMs: 60_000 },
132+
).catch(e => {
129133
// timed out?
130134
console.error('getStoreId:')
131135
console.error(e)

0 commit comments

Comments
 (0)