From bda65bdc9f3ce7d4b6e97cb9afaca25b71added3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Oct 2017 10:43:54 +0200 Subject: [PATCH] Fix pod removal when it is down --- server/controllers/api/pods.ts | 2 +- server/lib/friends.ts | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/server/controllers/api/pods.ts b/server/controllers/api/pods.ts index ec94efc35..804aa0659 100644 --- a/server/controllers/api/pods.ts +++ b/server/controllers/api/pods.ts @@ -83,6 +83,6 @@ function removeFriendController (req: express.Request, res: express.Response, ne const pod = res.locals.pod as PodInstance removeFriend(pod) - .then(() => (res.type('json').status(204).end())) + .then(() => res.type('json').status(204).end()) .catch(err => next(err)) } diff --git a/server/lib/friends.ts b/server/lib/friends.ts index 4cc4a82bf..65349ef5f 100644 --- a/server/lib/friends.ts +++ b/server/lib/friends.ts @@ -251,13 +251,10 @@ function removeFriend (pod: PodInstance) { } return makeSecureRequest(requestParams) + .catch(err => logger.warn('Cannot notify friends %s we are quitting him.', pod.host, err)) .then(() => pod.destroy()) - .then(() => { - logger.info('Removed friend.') - }) - .catch(err => { - logger.error('Some errors while quitting friend %s (id: %d).', pod.host, pod.id, err) - }) + .then(() => logger.info('Removed friend %s.', pod.host)) + .catch(err => logger.error('Cannot destroy friend %s.', pod.host, err)) } function getRequestScheduler () { -- 2.25.1