chore(xo-server/remotes): inline syncAllRemotes() and forgetAllRemotes()
This commit is contained in:
parent
3d4d7db5da
commit
2cc59078b1
@ -23,9 +23,19 @@ export default class {
|
||||
Promise.all(mapToArray(remotes, remote => this._remotes.save(remote)))
|
||||
)
|
||||
|
||||
await this.syncAllRemotes()
|
||||
const remotes = await this.getAllRemotes()
|
||||
forEach(remotes, remote => {
|
||||
this.updateRemote(remote.id, {})
|
||||
})
|
||||
})
|
||||
xo.on('stop', async () => {
|
||||
const remotes = await this.getAllRemotes()
|
||||
for (const remote of remotes) {
|
||||
try {
|
||||
;(await this.getRemoteHandler(remote, true)).forget()
|
||||
} catch (_) {}
|
||||
}
|
||||
})
|
||||
xo.on('stop', () => this.forgetAllRemotes())
|
||||
}
|
||||
|
||||
async getRemoteHandler (remote, ignoreDisabled) {
|
||||
@ -92,22 +102,4 @@ export default class {
|
||||
await handler.forget()
|
||||
await this._remotes.remove(id)
|
||||
}
|
||||
|
||||
// TODO: Should it be private?
|
||||
async syncAllRemotes () {
|
||||
const remotes = await this.getAllRemotes()
|
||||
forEach(remotes, remote => {
|
||||
this.updateRemote(remote.id, {})
|
||||
})
|
||||
}
|
||||
|
||||
// TODO: Should it be private?
|
||||
async forgetAllRemotes () {
|
||||
const remotes = await this.getAllRemotes()
|
||||
for (const remote of remotes) {
|
||||
try {
|
||||
;(await this.getRemoteHandler(remote, true)).forget()
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user