Skip to content

Commit 0b51ea2

Browse files
reorder interceprotors
1 parent 515ae2f commit 0b51ea2

2 files changed

Lines changed: 4793 additions & 5 deletions

File tree

archipy/helpers/utils/app_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ def create_async_grpc_app(
364364
from archipy.helpers.interceptors.grpc.exception import AsyncGrpcServerExceptionInterceptor
365365

366366
async_interceptors = [AsyncGrpcServerExceptionInterceptor()]
367-
if customized_interceptors:
368-
async_interceptors.extend(customized_interceptors)
367+
369368
AsyncGrpcAPIUtils.setup_trace_interceptor(config, async_interceptors)
370369
AsyncGrpcAPIUtils.setup_metric_interceptor(config, async_interceptors)
371370

@@ -376,7 +375,8 @@ def create_async_grpc_app(
376375
options=config.GRPC.SERVER_OPTIONS_CONFIG_LIST,
377376
maximum_concurrent_rpcs=config.GRPC.MAX_CONCURRENT_RPCS,
378377
)
379-
378+
if customized_interceptors:
379+
async_interceptors.extend(customized_interceptors)
380380
return app
381381

382382
@classmethod
@@ -390,10 +390,11 @@ def create_grpc_app(
390390
from archipy.helpers.interceptors.grpc.exception import GrpcServerExceptionInterceptor
391391

392392
interceptors = [GrpcServerExceptionInterceptor()]
393-
if customized_interceptors:
394-
interceptors.extend(customized_interceptors)
393+
395394
GrpcAPIUtils.setup_trace_interceptor(config, interceptors)
396395
GrpcAPIUtils.setup_metric_interceptor(config, interceptors)
396+
if customized_interceptors:
397+
interceptors.extend(customized_interceptors)
397398

398399
app = grpc.server(
399400
futures.ThreadPoolExecutor(max_workers=config.GRPC.THREAD_WORKER_COUNT),

0 commit comments

Comments
 (0)