From 1cd6eeab258b05079226943e7608cd0a687c518c Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 19 Apr 2019 15:01:56 -0700 Subject: [PATCH] chore(context): make sure invocation context is closed --- packages/context/src/interceptor.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/context/src/interceptor.ts b/packages/context/src/interceptor.ts index 604231a77b33..1b16a9fbef1c 100644 --- a/packages/context/src/interceptor.ts +++ b/packages/context/src/interceptor.ts @@ -262,8 +262,12 @@ export function invokeMethodWithInterceptors( ); assertMethodExists(invocationCtx); - const interceptors = loadInterceptors(invocationCtx); - return invokeInterceptors(invocationCtx, interceptors); + try { + const interceptors = loadInterceptors(invocationCtx); + return invokeInterceptors(invocationCtx, interceptors); + } finally { + invocationCtx.close(); + } } /**