Fix pod removal when it is down

pull/108/head
Chocobozzz 2017-10-19 10:43:54 +02:00
parent 10db166bbe
commit bda65bdc9f
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 4 additions and 7 deletions

View File

@ -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))
} }

View File

@ -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 () {