fix(queue): 定位回画布 / 已在图库判定 / 上限保护 / 缩略图与兜底
This commit is contained in:
1 parent
9edc635ed8
commit
630949eac7
8 files changed
+26
-19
No files matched your search
@@ -43,7 +43,8 @@
|
||||
const max = maxOf()
|
||||
if (arr.length > max) {
|
||||
// 淘汰最旧的非 pinned 记录(pinned = 被画布/图库引用)
|
||||
const drop = arr.filter((x) => !x.pinned).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
|
||||
const isActive = (x) => !!(x && (x.status === 'queued' || x.status === 'downloading'))
|
||||
const drop = arr.filter((x) => !x.pinned && !isActive(x) && x.id !== entry.id).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
|
||||
while (arr.length > max && drop.length) {
|
||||
const victim = drop.shift()
|
||||
const i = arr.indexOf(victim)
|
||||
@@ -64,7 +65,8 @@
|
||||
const arr = load()
|
||||
const max = maxOf()
|
||||
if (arr.length <= max) return 0
|
||||
const drop = arr.filter((x) => !x.pinned).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
|
||||
const isActive = (x) => !!(x && (x.status === 'queued' || x.status === 'downloading'))
|
||||
const drop = arr.filter((x) => !x.pinned && !isActive(x)).sort((a, b) => (a.createdAt || 0) - (b.createdAt || 0))
|
||||
let removed = 0
|
||||
while (arr.length > max && drop.length) {
|
||||
const victim = drop.shift()
|
||||
|
||||
Reference in new issue
Block a user