catch sync error

master
cyhhao 2 years ago
parent 28092ef0e1
commit 984a35f3d7

@ -167,6 +167,7 @@ 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}`
try {
let res = await api.post("/repos/migrate", { let res = await api.post("/repos/migrate", {
clone_addr: uri, clone_addr: uri,
mirror: true, mirror: true,
@ -178,12 +179,19 @@ async function mirrorRepo(hubAddr: string, repoName: string) {
uid: 0, 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}`
try {
let res = await api.post(`/repos/${hubAddr}/${repoName}/mirror-sync`) let res = await api.post(`/repos/${hubAddr}/${repoName}/mirror-sync`)
console.log("pullRepo", uri, res.status) 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