From 0aaa54c77a2393e4473c1fdc1979bb61b1e01303 Mon Sep 17 00:00:00 2001 From: Louis Grasset Date: Fri, 25 Aug 2023 14:15:19 +0200 Subject: [PATCH] feat(tweet-getter): prevent requests when tweet is already synced (#18) --- src/helpers/tweet/get-eligible-tweet.ts | 8 +++----- src/services/tweets-getter.service.ts | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/helpers/tweet/get-eligible-tweet.ts b/src/helpers/tweet/get-eligible-tweet.ts index 41bb68c..a1f2afd 100644 --- a/src/helpers/tweet/get-eligible-tweet.ts +++ b/src/helpers/tweet/get-eligible-tweet.ts @@ -1,12 +1,10 @@ import { Tweet } from '@the-convocation/twitter-scraper'; import { DEBUG } from '../../constants.js'; -import { Cache } from '../../types/index.js'; import { getPostExcerpt } from '../post/get-post-excerpt.js'; -import { isTweetCached, keepRecentTweets, keepSelfQuotes, keepSelfReplies } from './index.js'; +import { keepRecentTweets, keepSelfQuotes, keepSelfReplies } from './index.js'; -export const getEligibleTweet = async (tweet: Tweet, cache: Cache): Promise => { - const notCached = !isTweetCached(tweet, cache); +export const getEligibleTweet = async (tweet: Tweet): Promise => { const notRetweet = !tweet.isRetweet; const isSelfReply = await keepSelfReplies(tweet); @@ -14,7 +12,7 @@ export const getEligibleTweet = async (tweet: Tweet, cache: Cache): Promise { const stats = { @@ -28,7 +28,7 @@ export const tweetsGetterService = async (twitterClient: Scraper): Promise