Commit 0904aed0 authored by TheTechRobo's avatar TheTechRobo
Browse files

Get rid of cache

The cache is janky anyway and only really protects against a
repeated request (and even then, IIRC it is not perfect).
parent 1b2e54ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ RUN pip install --no-cache-dir hypercorn quart
RUN apt install -y openssl
RUN apt clean
# The following line does not necessarily have to be updated with the requirements.txt as this is just to speed up the requirements.txt part (to improve cachability)
RUN pip install --no-cache-dir snscrape==0.4.3.20220106 aiohttp[speedups] requests nest_asyncio cachetools click asyncache pyyaml
RUN pip install --no-cache-dir snscrape==0.4.3.20220106 aiohttp[speedups] requests click pyyaml

EXPOSE 8000
COPY . /app
+0 −2
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@ snscrape==0.4.3.20220106
quart
aiohttp[speedups]
requests
cachetools
click
asyncache
pyyaml
typing_extensions
+1 −4
Original line number Diff line number Diff line
@@ -9,8 +9,6 @@ import re

import asyncio
import aiohttp
import cachetools
import asyncache
import yaml

from snscrape.base import _JSONDataclass as JSONDataclass
@@ -32,7 +30,7 @@ class Service(JSONDataclass):
        archived (bool): Whether the video is archived or not.
        available (list[Link]): Links to the archived material.
        error (Optional[str]): An error message if an error was encountered; otherwise, null.
        lastupdated (int): The timestamp the data was retrieved from the server. Used internally to expire cache entries.
        lastupdated (int): The timestamp the data was retrieved from the server.
        name (str): The name of the service. Used in the UI.
        note (str): A footnote about the service. This could be different depending on conditions. For example, the Internet Archive has an extra passage if the item is dark. Used in the UI.
        rawraw (Any): The data used to check whether the video is archived on that particular service. For example, for GhostArchive, it would be the HTTP status code. The structure could change at any time.
@@ -74,7 +72,6 @@ class Service(JSONDataclass):
        return serviceConfig['enabled']

    @classmethod
    @asyncache.cached(cachetools.TTLCache(1024, 600))
    async def run(cls, id: str, session: aiohttp.ClientSession, includeRaw=True, **kwargs):
        """
        Retrieves the data from the service.