fix: fix bugs
This commit is contained in:
parent
361bfdb470
commit
6b7067a8d0
@ -167,7 +167,9 @@ class MediaChunkHolderManager(object):
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.chunk_lru = collections.OrderedDict()
|
||||
self.disk_chunk_cache = diskcache.Cache(f"{os.path.dirname(__file__)}/cache_media")
|
||||
self.disk_chunk_cache = diskcache.Cache(
|
||||
f"{os.path.dirname(__file__)}/cache_media", size_limit=MediaChunkHolderManager.MAX_CACHE_SIZE
|
||||
)
|
||||
self._restore_cache()
|
||||
|
||||
def _restore_cache(self) -> None:
|
||||
@ -178,6 +180,8 @@ class MediaChunkHolderManager(object):
|
||||
self._set_media_chunk_index(holder.info)
|
||||
except Exception as err:
|
||||
logger.warning(f"restore, {err=},{traceback.format_exc()}")
|
||||
while self.current_cache_size > self.MAX_CACHE_SIZE:
|
||||
self._remove_pop_chunk()
|
||||
|
||||
def get_chunk_holder_by_info(self, info: ChunkInfo) -> MediaChunkHolder:
|
||||
holder = self.incompleted_chunk.get(info.id)
|
||||
|
@ -42,7 +42,7 @@ class TgFileSystemClient(object):
|
||||
# task should: (task_id, callabledFunc)
|
||||
task_queue: asyncio.Queue
|
||||
task_id: int = 0
|
||||
me: Union[types.User, types.InputPeerUser]
|
||||
me: Union[types.User, types.InputPeerUser] = None
|
||||
# client config
|
||||
client_param: configParse.TgToFileSystemParameter.ClientConfigPatameter
|
||||
|
||||
|
@ -13,5 +13,7 @@ for v in backend_status["clients"]:
|
||||
|
||||
if need_login:
|
||||
import login
|
||||
login.loop()
|
||||
else:
|
||||
import search
|
||||
search.loop()
|
||||
|
@ -4,11 +4,11 @@ import os
|
||||
import streamlit as st
|
||||
import qrcode
|
||||
|
||||
sys.path.append(os.getcwd() + "/../")
|
||||
import configParse
|
||||
import utils
|
||||
import remote_api as api
|
||||
|
||||
@st.experimental_fragment
|
||||
def loop():
|
||||
url = api.login_client_by_qr_code_url()
|
||||
|
||||
if url is None or url == "":
|
||||
|
@ -3,13 +3,11 @@ import os
|
||||
|
||||
import streamlit as st
|
||||
|
||||
sys.path.append(os.getcwd() + "/../")
|
||||
import configParse
|
||||
import utils
|
||||
import remote_api as api
|
||||
|
||||
param = configParse.get_TgToFileSystemParameter()
|
||||
|
||||
@st.experimental_fragment
|
||||
def loop():
|
||||
if 'page_index' not in st.session_state:
|
||||
st.session_state.page_index = 1
|
||||
if 'force_skip' not in st.session_state:
|
||||
|
Loading…
x
Reference in New Issue
Block a user