Fix PR comments
This commit is contained in:
parent
e24e0a357b
commit
a857823099
|
@ -65,11 +65,10 @@ where
|
||||||
async fn run(mut self) -> Result<(), ServiceError> {
|
async fn run(mut self) -> Result<(), ServiceError> {
|
||||||
let endpoint = B::new(self.settings.backend_settings)
|
let endpoint = B::new(self.settings.backend_settings)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Box::new(e) as DynError)?;
|
.map_err(ServiceError::service)?;
|
||||||
endpoint
|
endpoint
|
||||||
.serve(self.handle)
|
.serve(self.handle)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| Box::new(e) as DynError)?;
|
.map_err(ServiceError::service)
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ where
|
||||||
backend,
|
backend,
|
||||||
inbound_relay,
|
inbound_relay,
|
||||||
})
|
})
|
||||||
.map_err(|e| ServiceError::Service(Box::new(e)))
|
.map_err(ServiceError::service)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn run(mut self) -> Result<(), ServiceError> {
|
async fn run(mut self) -> Result<(), ServiceError> {
|
||||||
|
@ -195,25 +195,12 @@ where
|
||||||
oneshot::Sender<async_graphql::Response>,
|
oneshot::Sender<async_graphql::Response>,
|
||||||
) -> Result<M, ServiceError>,
|
) -> Result<M, ServiceError>,
|
||||||
{
|
{
|
||||||
#[derive(Debug)]
|
let payload = payload.ok_or(ServiceError::custom("empty payload"))?;
|
||||||
struct EmptyPayload;
|
|
||||||
|
|
||||||
impl core::fmt::Display for EmptyPayload {
|
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
|
||||||
write!(f, "empty payload")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Error for EmptyPayload {}
|
|
||||||
|
|
||||||
let payload = payload
|
|
||||||
.ok_or(EmptyPayload)
|
|
||||||
.map_err(|e| ServiceError::Service(Box::new(e)))?;
|
|
||||||
let req = async_graphql::http::receive_batch_json(&payload[..])
|
let req = async_graphql::http::receive_batch_json(&payload[..])
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ServiceError::Service(Box::new(e)))?
|
.map_err(ServiceError::service)?
|
||||||
.into_single()
|
.into_single()
|
||||||
.map_err(|e| ServiceError::Service(Box::new(e)))?;
|
.map_err(ServiceError::service)?;
|
||||||
|
|
||||||
let (sender, receiver) = oneshot::channel();
|
let (sender, receiver) = oneshot::channel();
|
||||||
relay
|
relay
|
||||||
|
@ -226,6 +213,6 @@ where
|
||||||
.map_err(|e| ServiceError::RelayError(e.0))?;
|
.map_err(|e| ServiceError::RelayError(e.0))?;
|
||||||
|
|
||||||
let res = receiver.await.unwrap();
|
let res = receiver.await.unwrap();
|
||||||
let res = serde_json::to_string(&res).map_err(|e| ServiceError::Service(Box::new(e)))?;
|
let res = serde_json::to_string(&res).map_err(ServiceError::service)?;
|
||||||
Ok(res)
|
Ok(res)
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,7 +276,7 @@ impl<Backend: StorageBackend + Send + Sync + 'static> ServiceCore for StorageSer
|
||||||
fn init(service_state: ServiceStateHandle<Self>) -> Result<Self, ServiceError> {
|
fn init(service_state: ServiceStateHandle<Self>) -> Result<Self, ServiceError> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
backend: Backend::new(service_state.settings_reader.get_updated_settings())
|
backend: Backend::new(service_state.settings_reader.get_updated_settings())
|
||||||
.map_err(|e| ServiceError::Service(Box::new(e)))?,
|
.map_err(ServiceError::service)?,
|
||||||
service_state,
|
service_state,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,7 @@ impl ServiceCore for SystemSig {
|
||||||
|
|
||||||
async fn run(self) -> Result<(), ServiceError> {
|
async fn run(self) -> Result<(), ServiceError> {
|
||||||
let Self { service_state } = self;
|
let Self { service_state } = self;
|
||||||
let mut ctrlc =
|
let mut ctrlc = async_ctrlc::CtrlC::new().map_err(ServiceError::service)?;
|
||||||
async_ctrlc::CtrlC::new().map_err(|e| ServiceError::Service(Box::new(e)))?;
|
|
||||||
let mut lifecycle_stream = service_state.lifecycle_handle.message_stream();
|
let mut lifecycle_stream = service_state.lifecycle_handle.message_stream();
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|
Loading…
Reference in New Issue