fix: check if user service is bootstrapped before removing instances (#835)

This commit is contained in:
Liu Xiaoyi
2024-12-18 03:09:03 +08:00
committed by GitHub
parent 99a1b6bbd0
commit f550b54399

View File

@@ -46,6 +46,8 @@ export const destroyUserServices = async (userId: UserInDatabase['_id'], drop =
delete serviceInstances[userId];
if (userServiceInstances === undefined || userServiceInstances === null) return;
return Promise.all(
Object.keys(userServiceInstances).map((key) => userServiceInstances[key as keyof ServiceInstances].destroy(drop)),
);