Skip to content

Commit

Permalink
More delays
Browse files Browse the repository at this point in the history
  • Loading branch information
vloss3 committed Dec 10, 2024
1 parent a5e48e1 commit 2f5ca96
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function getDynamicUrl() {

async function checkRoute(origin, destination, date) {
try {
const delay = Math.floor(Math.random() * (300 - 50 + 1)) + 50;
const delay = Math.floor(Math.random() * (300 - 50 + 1)) + 100;
await new Promise((resolve) => setTimeout(resolve, delay));

const dynamicUrl = await getDynamicUrl();
Expand Down Expand Up @@ -204,9 +204,9 @@ async function checkAllRoutes() {
for (const destination of destinations) {
if (isRateLimited) break;

if (completedRoutes > 0 && completedRoutes % 30 === 0) {
progressElement.textContent = `Taking a 5 second break to avoid rate limiting...`;
await new Promise(resolve => setTimeout(resolve, 5000));
if (completedRoutes > 0 && completedRoutes % 25 === 0) {
progressElement.textContent = `Taking a 15 second break to avoid rate limiting...`;
await new Promise(resolve => setTimeout(resolve, 15000));
}

const updateProgress = () => {
Expand Down

0 comments on commit 2f5ca96

Please sign in to comment.