remove unused mutability to defuse deadlock

This commit is contained in:
Jane Lusby 2020-11-30 16:47:44 -08:00 committed by Deirdre Connolly
parent 4d5ea4897c
commit fceef849cf
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ impl Tracing {
/// Reload the currently-active filter with the supplied value.
///
/// This can be used to provide a dynamic tracing filter endpoint.
pub fn reload_filter(&mut self, filter: impl Into<EnvFilter>) {
pub fn reload_filter(&self, filter: impl Into<EnvFilter>) {
self.filter_handle
.reload(filter)
.expect("the subscriber is not dropped before the component is");

View File

@ -104,10 +104,10 @@ To set the filter, POST the new filter string to /filter:
.expect("response with known status code cannot fail"),
(&Method::POST, "/filter") => match read_filter(req).await {
Ok(filter) => {
app_writer()
.state_mut()
app_reader()
.state()
.components
.get_downcast_mut::<Tracing>()
.get_downcast_ref::<Tracing>()
.expect("Tracing component should be available")
.reload_filter(filter);