Increase wait time signifigantly for edits

This commit is contained in:
cyi1341 2024-02-13 13:12:10 +08:00
parent 971c4adf96
commit bc12369a70
1 changed files with 16 additions and 11 deletions

View File

@ -85,12 +85,15 @@
}
const data = await response.json();
// Extract the text from the response
const parsedData = JSON.parse(data.candidates[0].content.parts[0].text.slice(8, -3)); // remove the backticks and parse the JSON
console.log(parsedData);
return parsedData;
try {
// Extract the text from the response
const parsedData = JSON.parse(data.candidates[0].content.parts[0].text.slice(8, -3)); // remove the backticks and parse the JSON
console.log(parsedData);
return parsedData;
}
catch (error) {
return {}
}
} catch (error) {
console.log(`Error in request. Retrying in 5 seconds. Error: ${error.message}`);
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds before retrying
@ -958,9 +961,11 @@
if (getTextNodes()[titleIndex.bestTitle] !== undefined) {
console.log('Index found at', titleIndex.bestTitle);
clickRadioInputAtIndex(titleIndex.bestTitle);
new Promise(resolve => setTimeout(resolve, 2500));
clickSubmitButton();
isSubmitted = true;
if (!descriptionEdit) {
new Promise(resolve => setTimeout(resolve, 7500));
clickSubmitButton();
isSubmitted = true;
}
} else {
console.log('Index not found')
}
@ -995,7 +1000,7 @@
if (getTextNodes()[descriptionIndex.bestDescription] !== undefined) {
console.log('Index found at', descriptionIndex.bestDescription);
clickRadioInputAtIndex(descriptionIndex.bestDescription);
new Promise(resolve => setTimeout(resolve, 3500));
new Promise(resolve => setTimeout(resolve, 7500));
clickSubmitButton();
isSubmitted = true;
} else {
@ -1014,7 +1019,7 @@
clickCheckboxWithLocationMessage();
console.log("Is Location Edit")
setTimeout(function() {
new Promise(resolve => setTimeout(resolve, 2500));
new Promise(resolve => setTimeout(resolve, 7500));
if (getTextNodes().length === 0) {
clickSubmitButton();
isSubmitted = true;