Skip to content

Commit b7cc03f

Browse files
committed
fix: 修 没有同步文件的情况
1 parent 99148ed commit b7cc03f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ WORKDIR /opt/python-openbmclapi
1010
ADD . .
1111

1212
RUN pip install -r requirements.txt
13-
ENV cluster.port=6543
13+
ENV web.public_port=6543
1414
EXPOSE 6543
1515
CMD ["python", "./main.py"]

core/cluster.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ async def sync(self):
329329

330330
if not missing:
331331
logger.tsuccess("cluster.success.no_missing_files")
332+
self.run_task()
332333
return
333334

334335
await self.clusters.storage_manager.available()
@@ -342,8 +343,11 @@ async def sync(self):
342343
self.sync_sem.set_value(configuration.concurrency)
343344

344345
await self.download(missing)
346+
self.run_task()
345347

346-
self.task = scheduler.run_repeat_later(self.sync, 600, 600)
348+
def run_task(self):
349+
scheduler.cancel(self.task)
350+
self.task = scheduler.run_later(self.sync, 600)
347351

348352
async def download(self, filelist: set[File]):
349353
total = len(filelist)
@@ -1006,6 +1010,8 @@ async def _(request: aweb.Request):
10061010
return resp
10071011

10081012
file = await clusters.storage_manager.get_file(hash)
1013+
if file is None:
1014+
return resp
10091015
start = request.http_range.start or 0
10101016
end = request.http_range.stop or file.size
10111017
size = end - start + 1

core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def threads(self):
112112

113113
@property
114114
def public_port(self):
115-
return Config.get("web.public_port", 6000)
115+
return os.environ.get("web.public_port", Config.get("web.public_port", 6543))
116116

117117
@property
118118
def ssl_dir(self):

0 commit comments

Comments
 (0)