fix: 修改视频列表获取逻辑,支持级别 2 的请求以增加最大页数和限制
This commit is contained in:
parent
cf74282459
commit
7f60997a58
28
DB.py
28
DB.py
@ -6,8 +6,8 @@ import time
|
|||||||
|
|
||||||
class DBVidcon:
|
class DBVidcon:
|
||||||
_MYSQL_CONF = {
|
_MYSQL_CONF = {
|
||||||
"host": "192.144.230.75", # "127.0.0.1", #
|
"host": "192.144.230.75", # "127.0.0.1", #
|
||||||
"port": 3306, # 3307, #
|
"port": 3306, # 3307, #
|
||||||
"user": "db_vidcon",
|
"user": "db_vidcon",
|
||||||
"password": "rexdK4fhCCiRE4BZ",
|
"password": "rexdK4fhCCiRE4BZ",
|
||||||
"database": "db_vidcon",
|
"database": "db_vidcon",
|
||||||
@ -15,8 +15,8 @@ class DBVidcon:
|
|||||||
"cursorclass": pymysql.cursors.DictCursor,
|
"cursorclass": pymysql.cursors.DictCursor,
|
||||||
}
|
}
|
||||||
_REDIS_CONF = {
|
_REDIS_CONF = {
|
||||||
"host": "192.144.230.75", # "127.0.0.1", #
|
"host": "192.144.230.75", # "127.0.0.1", #
|
||||||
"port": 6379, # 6380, #
|
"port": 6379, # 6380, #
|
||||||
"password": "qwert@$123!&",
|
"password": "qwert@$123!&",
|
||||||
"decode_responses": True,
|
"decode_responses": True,
|
||||||
}
|
}
|
||||||
@ -268,3 +268,23 @@ class DBVidcon:
|
|||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
return proxy
|
return proxy
|
||||||
|
|
||||||
|
def queues_empty(self) -> bool:
|
||||||
|
"""
|
||||||
|
判断 urgent_list_key 和 list_key 两个队列是否都为空。
|
||||||
|
如果都空,返回 True;只要有一个不空,就返回 False。
|
||||||
|
"""
|
||||||
|
# 注意:redis.llen 返回 int
|
||||||
|
return (
|
||||||
|
self.redis.llen(self.urgent_list_key) == 0
|
||||||
|
and self.redis.llen(self.list_key) == 0
|
||||||
|
)
|
||||||
|
|
||||||
|
def pop_error_item(self):
|
||||||
|
"""
|
||||||
|
从 error_list_key 中弹出一个错误记录(lpop),
|
||||||
|
如果队列为空,返回 None。
|
||||||
|
"""
|
||||||
|
item = self.redis.lpop(self.error_list_key)
|
||||||
|
# 如果你存入的是 JSON 字符串,可以在这里做一次反序列化:
|
||||||
|
return json.loads(item) if item is not None else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user