Sync tracks/tags automatically if <5
This commit is contained in:
parent
011db51e11
commit
6cc0003120
2 changed files with 7 additions and 1 deletions
|
@ -9,6 +9,8 @@ const {z} = require("zod")
|
|||
|
||||
const {sync, db, router} = require("../passthrough")
|
||||
const pugSync = sync.require("../pug-sync")
|
||||
/** @type {import("./load-tags")} */
|
||||
const loadTags = sync.require("./load-tags")
|
||||
|
||||
async function loadCollection(inputUsername) {
|
||||
assert.match(inputUsername, /^[a-z0-9_-]+$/)
|
||||
|
@ -74,6 +76,10 @@ async function loadCollection(inputUsername) {
|
|||
})()
|
||||
const storedTrackCount = db.prepare("SELECT count(*) AS count FROM track WHERE account = ?").pluck().get(account)
|
||||
|
||||
// load full tracks/tags immediately if there's not too many
|
||||
const downloader = loadTags.downloadManager.check(account)
|
||||
if (downloader.total <= 5) loadTags.downloadManager.start(account)
|
||||
|
||||
return {
|
||||
storedItemCount,
|
||||
storedTrackCount,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue