mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-11 07: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);
|
||||
let success = [],
|
||||
failed = [];
|
||||
for (const artifact of Object.values(allArtifacts)) {
|
||||
|
||||
await Promise.all(Object.values(allArtifacts).map(async artifact => {
|
||||
if (artifact.sync) {
|
||||
$.info(`正在同步云配置:${artifact.name}...`);
|
||||
try {
|
||||
@ -687,10 +688,13 @@ function service() {
|
||||
});
|
||||
artifact.updated = new Date().getTime();
|
||||
const body = JSON.parse(resp.body);
|
||||
|
||||
// extract real url from gist
|
||||
artifact.url = body.files[artifact.name].raw_url.replace(
|
||||
/\/raw\/[^\/]*\/(.*)/,
|
||||
"/raw/$1"
|
||||
);
|
||||
|
||||
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||
$.info(`✅ 成功同步云配置:${artifact.name}`);
|
||||
success.push(artifact);
|
||||
@ -704,7 +708,8 @@ function service() {
|
||||
failed.push(artifact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
res.json({
|
||||
success,
|
||||
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