mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-24 15:24:03 +08:00
add fake redis
This commit is contained in:
parent
78e5ed8568
commit
b7733fbc9f
2 changed files with 6 additions and 2 deletions
|
@ -29,6 +29,6 @@ OWNER = os.getenv("OWNER", "BennyThink")
|
|||
APP_ID: "int" = int(os.getenv("APP_ID", 111))
|
||||
APP_HASH = os.getenv("APP_HASH", "111")
|
||||
TOKEN = os.getenv("TOKEN", "3703WLI")
|
||||
REDIS = os.getenv("REDIS", "redis")
|
||||
REDIS = os.getenv("REDIS")
|
||||
|
||||
WORKERS: "int" = int(os.getenv("WORKERS", 100))
|
||||
|
|
6
limit.py
6
limit.py
|
@ -18,6 +18,7 @@ import tempfile
|
|||
import time
|
||||
from io import BytesIO
|
||||
|
||||
import fakeredis
|
||||
import redis
|
||||
import requests
|
||||
from beautifultable import BeautifulTable
|
||||
|
@ -29,7 +30,10 @@ from config import (AFD_TOKEN, AFD_USER_ID, COFFEE_TOKEN, ENABLE_VIP, EX,
|
|||
class Redis:
|
||||
def __init__(self):
|
||||
super(Redis, self).__init__()
|
||||
self.r = redis.StrictRedis(host=REDIS, db=4, decode_responses=True)
|
||||
if REDIS is None:
|
||||
self.r = fakeredis.FakeStrictRedis(host=REDIS, db=4, decode_responses=True)
|
||||
else:
|
||||
self.r = redis.StrictRedis(host=REDIS, db=4, decode_responses=True)
|
||||
|
||||
db_banner = "=" * 20 + "DB data" + "=" * 20
|
||||
quota_banner = "=" * 20 + "Quota" + "=" * 20
|
||||
|
|
Loading…
Reference in a new issue