diff options
| author | MatthieuCoder <matthieu@matthieu-dev.xyz> | 2022-12-31 22:48:40 +0400 |
|---|---|---|
| committer | MatthieuCoder <matthieu@matthieu-dev.xyz> | 2022-12-31 22:48:40 +0400 |
| commit | 46fd26962ef55f8b557f7e36d3aee915a819c88c (patch) | |
| tree | 18038653ee532831aca0000afa7849924c2c63cc /exes/webhook/src/handler/handler.rs | |
| parent | 0fcc68291a5f7526dbeffe33f4a84a649200e847 (diff) | |
add base of cache component
Diffstat (limited to 'exes/webhook/src/handler/handler.rs')
| -rw-r--r-- | exes/webhook/src/handler/handler.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/exes/webhook/src/handler/handler.rs b/exes/webhook/src/handler/handler.rs index 3294c22..b2ef44c 100644 --- a/exes/webhook/src/handler/handler.rs +++ b/exes/webhook/src/handler/handler.rs @@ -8,7 +8,7 @@ use hyper::{ Body, Method, Request, Response, StatusCode, }; use serde::{Deserialize, Serialize}; -use shared::nats_crate::Connection; +use shared::nats_crate::Client; use shared::{ log::{debug, error}, payloads::{CachePayload, DispatchEventTagged, Tracing}, @@ -19,7 +19,6 @@ use std::{ str::from_utf8, sync::Arc, task::{Context, Poll}, - time::Duration, }; use twilight_model::gateway::event::{DispatchEvent}; use twilight_model::{ @@ -31,7 +30,7 @@ use twilight_model::{ #[derive(Clone)] pub struct HandlerService { pub config: Arc<Config>, - pub nats: Arc<Connection>, + pub nats: Arc<Client>, pub public_key: Arc<PublicKey>, } @@ -107,14 +106,13 @@ impl HandlerService { let payload = serde_json::to_string(&data).unwrap(); - match self.nats.request_timeout( - "nova.cache.dispatch.INTERACTION_CREATE", - payload, - Duration::from_secs(2), - ) { + match self.nats.request( + "nova.cache.dispatch.INTERACTION_CREATE".to_string(), + Bytes::from(payload), + ).await { Ok(response) => Ok(Response::builder() .header("Content-Type", "application/json") - .body(Body::from(response.data)) + .body(Body::from(response.reply.unwrap())) .unwrap()), Err(error) => { |
