mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 11:28:59 +08:00
Improve the performance of cronSyncArtifact
This commit is contained in:
parent
4dc40e92ae
commit
7b68f9fa85
@ -660,7 +660,8 @@ function service() {
|
|||||||
const allArtifacts = $.read(ARTIFACTS_KEY);
|
const allArtifacts = $.read(ARTIFACTS_KEY);
|
||||||
let success = [],
|
let success = [],
|
||||||
failed = [];
|
failed = [];
|
||||||
for (const artifact of Object.values(allArtifacts)) {
|
|
||||||
|
await Promise.all(Object.values(allArtifacts).map(async artifact => {
|
||||||
if (artifact.sync) {
|
if (artifact.sync) {
|
||||||
$.info(`正在同步云配置:${artifact.name}...`);
|
$.info(`正在同步云配置:${artifact.name}...`);
|
||||||
try {
|
try {
|
||||||
@ -687,10 +688,13 @@ function service() {
|
|||||||
});
|
});
|
||||||
artifact.updated = new Date().getTime();
|
artifact.updated = new Date().getTime();
|
||||||
const body = JSON.parse(resp.body);
|
const body = JSON.parse(resp.body);
|
||||||
|
|
||||||
|
// extract real url from gist
|
||||||
artifact.url = body.files[artifact.name].raw_url.replace(
|
artifact.url = body.files[artifact.name].raw_url.replace(
|
||||||
/\/raw\/[^\/]*\/(.*)/,
|
/\/raw\/[^\/]*\/(.*)/,
|
||||||
"/raw/$1"
|
"/raw/$1"
|
||||||
);
|
);
|
||||||
|
|
||||||
$.write(allArtifacts, ARTIFACTS_KEY);
|
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||||
$.info(`✅ 成功同步云配置:${artifact.name}`);
|
$.info(`✅ 成功同步云配置:${artifact.name}`);
|
||||||
success.push(artifact);
|
success.push(artifact);
|
||||||
@ -704,7 +708,8 @@ function service() {
|
|||||||
failed.push(artifact);
|
failed.push(artifact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}));
|
||||||
|
|
||||||
res.json({
|
res.json({
|
||||||
success,
|
success,
|
||||||
failed,
|
failed,
|
||||||
|
4
backend/sub-store.min.js
vendored
4
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user