mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 00:01:24 +01:00
Make tracing filter reload handles mutable
Makes the following diff nicer.
This commit is contained in:
parent
4cc390345a
commit
5eab758bd2
3 changed files with 9 additions and 7 deletions
|
|
@ -79,7 +79,8 @@ impl<L, S> ReloadHandle<L> for reload::Handle<L, S> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type-erased [reload handle][reload::Handle] for an [`EnvFilter`].
|
/// A type-erased [reload handle][reload::Handle] for an [`EnvFilter`].
|
||||||
pub(crate) type FilterReloadHandle = Box<dyn ReloadHandle<EnvFilter> + Sync>;
|
pub(crate) type FilterReloadHandle =
|
||||||
|
Box<dyn ReloadHandle<EnvFilter> + Send + Sync>;
|
||||||
|
|
||||||
/// Collection of [`FilterReloadHandle`]s, allowing the filters for tracing
|
/// Collection of [`FilterReloadHandle`]s, allowing the filters for tracing
|
||||||
/// backends to be changed dynamically. Handles may be [`None`] if the backend
|
/// backends to be changed dynamically. Handles may be [`None`] if the backend
|
||||||
|
|
|
||||||
|
|
@ -1176,12 +1176,13 @@ impl Service {
|
||||||
"Reloading filters is disabled",
|
"Reloading filters is disabled",
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
let mut handles = handles.write().await;
|
||||||
let handle = match backend {
|
let handle = match backend {
|
||||||
TracingBackend::Log => &handles.log,
|
TracingBackend::Log => &mut handles.log,
|
||||||
TracingBackend::Flame => &handles.flame,
|
TracingBackend::Flame => &mut handles.flame,
|
||||||
TracingBackend::Traces => &handles.traces,
|
TracingBackend::Traces => &mut handles.traces,
|
||||||
};
|
};
|
||||||
let Some(handle) = handle else {
|
let Some(handle) = handle.as_mut() else {
|
||||||
return Ok(RoomMessageEventContent::text_plain(
|
return Ok(RoomMessageEventContent::text_plain(
|
||||||
"Backend is disabled",
|
"Backend is disabled",
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ pub(crate) mod marker {
|
||||||
|
|
||||||
pub(crate) struct Service {
|
pub(crate) struct Service {
|
||||||
pub(crate) db: &'static dyn Data,
|
pub(crate) db: &'static dyn Data,
|
||||||
pub(crate) reload_handles: Option<FilterReloadHandles>,
|
pub(crate) reload_handles: Option<Arc<RwLock<FilterReloadHandles>>>,
|
||||||
|
|
||||||
// actual_destination, host
|
// actual_destination, host
|
||||||
pub(crate) actual_destination_cache: Arc<RwLock<WellKnownMap>>,
|
pub(crate) actual_destination_cache: Arc<RwLock<WellKnownMap>>,
|
||||||
|
|
@ -252,7 +252,7 @@ impl Service {
|
||||||
let mut s = Self {
|
let mut s = Self {
|
||||||
db,
|
db,
|
||||||
config,
|
config,
|
||||||
reload_handles,
|
reload_handles: reload_handles.map(|h| Arc::new(RwLock::new(h))),
|
||||||
keypair: Arc::new(keypair),
|
keypair: Arc::new(keypair),
|
||||||
dns_resolver: TokioAsyncResolver::tokio_from_system_conf()
|
dns_resolver: TokioAsyncResolver::tokio_from_system_conf()
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue