perf(router): remove routing indirection

Removes an unnecessary Arc pointer indirection for routing to the HTTP
handler delegate.
pull/24376/head
Dom Dwyer 2022-10-26 16:38:52 +02:00
parent b78433bd5d
commit 2331aaac94
3 changed files with 5 additions and 12 deletions

View File

@ -289,12 +289,11 @@ pub async fn create_router_server_type(
let shard_service = init_shard_service(sharder, write_buffer_config, catalog).await?;
// Initialise the API delegates
let handler_stack = Arc::new(handler_stack);
let http = HttpDelegate::new(
common_state.run_config().max_http_request_size,
request_limit,
namespace_resolver,
Arc::clone(&handler_stack),
handler_stack,
&metrics,
);
let grpc = GrpcDelegate::new(schema_catalog, object_store, shard_service);

View File

@ -2,7 +2,7 @@
mod delete_predicate;
use std::{str::Utf8Error, sync::Arc, time::Instant};
use std::{str::Utf8Error, time::Instant};
use bytes::{Bytes, BytesMut};
use data_types::{org_and_bucket_to_database, OrgBucketMappingError};
@ -229,7 +229,7 @@ pub struct HttpDelegate<D, N, T = SystemProvider> {
max_request_bytes: usize,
time_provider: T,
namespace_resolver: N,
dml_handler: Arc<D>,
dml_handler: D,
// A request limiter to restrict the number of simultaneous requests this
// router services.
@ -259,7 +259,7 @@ impl<D, N> HttpDelegate<D, N, SystemProvider> {
max_request_bytes: usize,
max_requests: usize,
namespace_resolver: N,
dml_handler: Arc<D>,
dml_handler: D,
metrics: &metric::Registry,
) -> Self {
let write_metric_lines = metrics

View File

@ -118,13 +118,7 @@ impl TestContext {
iox_catalog::INFINITE_RETENTION_POLICY.to_owned(),
);
let delegate = HttpDelegate::new(
1024,
100,
namespace_resolver,
Arc::new(handler_stack),
&metrics,
);
let delegate = HttpDelegate::new(1024, 100, namespace_resolver, handler_stack, &metrics);
Self {
delegate,