Skip to content

Commit 7b5a225

Browse files
committed
Merge branch 'main' into portable
2 parents 8ae2e5e + 08d8e54 commit 7b5a225

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

backend.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,10 @@
3434
allow_headers=["*"],
3535
)
3636

37-
cache_ttl_secs = 600
38-
api_cache = LRUCache(maxseze=1000)
39-
4037
def get_proxy():
4138
proxy = FreeProxy(rand=True, timeout=1).get()
4239
return proxy
4340

44-
async def get_data_from_api(url, session):
45-
async with async_timeout.timeout(cache_ttl_secs):
46-
async with session.get(url) as response:
47-
data = await response.json()
48-
api_cache[url] = (data, datetime.now())
49-
return data
5041

5142
@app.post("/chat/completions")
5243
@app.post("/v1/chat/completions")
@@ -322,16 +313,6 @@ async def run_check_script():
322313
# Pause for 5 minutes before starting the next cycle
323314
time.sleep(360)
324315

325-
# Асинхронная функция для обновления кэша данных из API
326-
async def update_api_cache():
327-
while True:
328-
try:
329-
# Обновление данных каждые 10 минут
330-
await asyncio.sleep(360)
331-
api_cache.clear()
332-
except:
333-
pass
334-
335316
# Запуск асинхронных задач
336317
async def run_tasks():
337318
while True:

0 commit comments

Comments
 (0)