catch sync error

master
cyhhao 2 years ago
parent 28092ef0e1
commit 984a35f3d7

@ -167,23 +167,31 @@ async function syncHub(hubAddr: string, start: number) {
async function mirrorRepo(hubAddr: string, repoName: string) { async function mirrorRepo(hubAddr: string, repoName: string) {
let uri = `git3://${hubAddr}/${repoName}` let uri = `git3://${hubAddr}/${repoName}`
let res = await api.post("/repos/migrate", { try {
clone_addr: uri, let res = await api.post("/repos/migrate", {
mirror: true, clone_addr: uri,
mirror_interval: "1h", mirror: true,
private: false, mirror_interval: "1h",
repo_name: repoName, private: false,
repo_owner: hubAddr, repo_name: repoName,
service: "git", repo_owner: hubAddr,
uid: 0, service: "git",
}) uid: 0,
console.log("mirrorRepo", uri, res.status) })
console.log("mirrorRepo", uri, res.status)
} catch (e) {
console.error("mirrorRepo", e)
}
} }
async function pullRepo(hubAddr: string, repoName: string) { async function pullRepo(hubAddr: string, repoName: string) {
let uri = `git3://${hubAddr}/${repoName}` let uri = `git3://${hubAddr}/${repoName}`
let res = await api.post(`/repos/${hubAddr}/${repoName}/mirror-sync`) try {
console.log("pullRepo", uri, res.status) let res = await api.post(`/repos/${hubAddr}/${repoName}/mirror-sync`)
console.log("pullRepo", uri, res.status)
} catch (e) {
console.error("pullRepo", e)
}
} }
async function migrateHub(oldHubAddr: string, newHubAddr: string) { async function migrateHub(oldHubAddr: string, newHubAddr: string) {

Loading…
Cancel
Save