summaryrefslogtreecommitdiff
path: root/webhook/src/handler/handler.rs
diff options
context:
space:
mode:
authorMatthieu <matthieu@developershouse.xyz>2021-10-12 22:51:30 +0400
committerMatthieu <matthieu@developershouse.xyz>2021-10-12 22:51:30 +0400
commit005dadb342c6a79d154d3eaf5a5fbb86f3a7e641 (patch)
tree8363ea7992b6275e32e019e68678f28bfe40fdb1 /webhook/src/handler/handler.rs
parenta02b25f235ba6eff33c6fd965c97071d5f112b6d (diff)
tests, cleanup & rest base
Diffstat (limited to 'webhook/src/handler/handler.rs')
-rw-r--r--webhook/src/handler/handler.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/webhook/src/handler/handler.rs b/webhook/src/handler/handler.rs
index 9545bec..b3dc8a6 100644
--- a/webhook/src/handler/handler.rs
+++ b/webhook/src/handler/handler.rs
@@ -5,17 +5,10 @@ use hyper::{
service::Service,
Body, Method, Request, Response, StatusCode,
};
-use log::{error, info, trace};
-use nats::Connection;
+use common::log::{error, info, trace};
+use common::nats_crate::Connection;
use serde::{Deserialize, Serialize};
-use std::{
- future::Future,
- io::{Error, ErrorKind},
- pin::Pin,
- str::from_utf8,
- sync::Arc,
- task::{Context, Poll},
-};
+use std::{future::Future, io::{Error, ErrorKind}, pin::Pin, str::from_utf8, sync::Arc, task::{Context, Poll}, time::Duration};
/// Hyper service used to handle the discord webhooks
#[derive(Clone)]
@@ -105,13 +98,14 @@ impl Service<Request<Body>> for HandlerService {
node_id: "".to_string(),
span: None,
},
+ operation: "".to_string(),
data: value,
})
.unwrap();
match self_clone
.nats
- .request("nova.cache.dispatch.interaction", payload)
+ .request_timeout("nova.cache.dispatch.interaction", payload, Duration::from_secs(2))
{
Ok(response) => Ok(Response::builder()
.header("Content-Type", "application/json")