diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2021-03-06 16:05:00 +0000 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2021-03-06 16:05:00 +0000 |
commit | eb7d513356362db925eefbf50f967b4d983d7bd9 (patch) | |
tree | 8aced33b2ef3e95aeb16e1b1c66825aa7ea31c25 /database.py | |
parent | 7f549879d0a29313c75e96a623c1b4606dce5a06 (diff) | |
download | boymoder.blog-eb7d513356362db925eefbf50f967b4d983d7bd9.tar.gz boymoder.blog-eb7d513356362db925eefbf50f967b4d983d7bd9.zip |
fixed bug with duplication
Diffstat (limited to 'database.py')
-rw-r--r-- | database.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/database.py b/database.py index 0edcad7..06dc34d 100644 --- a/database.py +++ b/database.py @@ -125,8 +125,9 @@ class Database: return list(cursor.fetchall()) def update_twitter_cache(self, requested): - urls = [i[1] for i in self.get_cached_tweets(recurse = False)] with self.__connection.cursor() as cursor: + cursor.execute("SELECT DISTINCT url FROM twitterCache;") + urls = [i[0] for i in cursor.fetchall()] for url, text in requested: if url not in urls: cursor.execute("INSERT INTO twitterCache (text, url) VALUES (%s, %s);", (text, url)) @@ -151,8 +152,9 @@ class Database: } for i in cursor.fetchall()] def update_commit_cache(self, requested): - urls = [i["url"] for i in self.get_cached_commits(recurse = False)] with self.__connection.cursor() as cursor: + cursor.execute("SELECT DISTINCT url FROM commitCache;") + urls = [i[0] for i in cursor.fetchall()] for commit in requested: if commit["url"] not in urls: cursor.execute(""" |