mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Fixed spammed API
This commit is contained in:
parent
b67d845d88
commit
b661943b28
2 changed files with 24 additions and 2 deletions
|
|
@ -511,8 +511,18 @@ def scan_library_task(
|
|||
processed=0,
|
||||
)
|
||||
else:
|
||||
scan.record_stage_progress("metadata", processed=0)
|
||||
scan.record_stage_progress("artwork", processed=0)
|
||||
if scan.metadata_status == LibraryScan.STAGE_STATUS_PENDING:
|
||||
scan.record_stage_progress(
|
||||
"metadata",
|
||||
status=LibraryScan.STAGE_STATUS_RUNNING,
|
||||
processed=scan.metadata_processed,
|
||||
)
|
||||
if scan.artwork_status == LibraryScan.STAGE_STATUS_PENDING:
|
||||
scan.record_stage_progress(
|
||||
"artwork",
|
||||
status=LibraryScan.STAGE_STATUS_RUNNING,
|
||||
processed=scan.artwork_processed,
|
||||
)
|
||||
|
||||
scanner.finalize(matched=matched, unmatched=unmatched, summary=summary)
|
||||
logger.info("Completed scan for library %s", library.name)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,18 @@ const shouldRefreshMetadata = (item) => {
|
|||
|
||||
const queueMetadataRefresh = (items, { force = false } = {}) => {
|
||||
if (!Array.isArray(items) || items.length === 0) return;
|
||||
|
||||
if (!force) {
|
||||
// Discovery pipeline now queues metadata/artwork on the backend.
|
||||
// Skip client-side batching to avoid flooding the API when large scans run.
|
||||
items.forEach((item) => {
|
||||
if (item?.id) {
|
||||
metadataRequestCache.delete(item.id);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
items.forEach((item) => {
|
||||
if (!shouldRefreshMetadata(item)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue