Fix pod removal when it is down
This commit is contained in:
parent
10db166bbe
commit
bda65bdc9f
|
@ -83,6 +83,6 @@ function removeFriendController (req: express.Request, res: express.Response, ne
|
||||||
const pod = res.locals.pod as PodInstance
|
const pod = res.locals.pod as PodInstance
|
||||||
|
|
||||||
removeFriend(pod)
|
removeFriend(pod)
|
||||||
.then(() => (res.type('json').status(204).end()))
|
.then(() => res.type('json').status(204).end())
|
||||||
.catch(err => next(err))
|
.catch(err => next(err))
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,13 +251,10 @@ function removeFriend (pod: PodInstance) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeSecureRequest(requestParams)
|
return makeSecureRequest(requestParams)
|
||||||
|
.catch(err => logger.warn('Cannot notify friends %s we are quitting him.', pod.host, err))
|
||||||
.then(() => pod.destroy())
|
.then(() => pod.destroy())
|
||||||
.then(() => {
|
.then(() => logger.info('Removed friend %s.', pod.host))
|
||||||
logger.info('Removed friend.')
|
.catch(err => logger.error('Cannot destroy friend %s.', pod.host, err))
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
logger.error('Some errors while quitting friend %s (id: %d).', pod.host, pod.id, err)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRequestScheduler () {
|
function getRequestScheduler () {
|
||||||
|
|
Loading…
Reference in New Issue