Skip to content

Commit

Permalink
Merge pull request #62 from hasanafzal8485/refine-index-check
Browse files Browse the repository at this point in the history
Enhance Cache logic to to save Api limit
  • Loading branch information
goenning committed Jun 20, 2024
2 parents d6617fb + 93dd956 commit e49a653
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/six-mirrors-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"google-indexing-script": minor
---

Don't want the same URL use my API limit again until his previous cache limit is completed
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const index = async (input: string = process.argv[2], options: IndexOptio
const shouldRecheck = (status: Status, lastCheckedAt: string) => {
const shouldIndexIt = indexableStatuses.includes(status);
const isOld = new Date(lastCheckedAt) < new Date(Date.now() - CACHE_TIMEOUT);
return shouldIndexIt || isOld;
return shouldIndexIt && isOld;;
};

await batch(
Expand Down

0 comments on commit e49a653

Please sign in to comment.