mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 10:06:32 +08:00 
			
		
		
		
	refactor(stripe): return all the missing fields in a request (#935)
Co-authored-by: jeeva <jeeva.ramu@codurance.com> Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com> Co-authored-by: ItsMeShashank <sattarde9913@gmail.com>
This commit is contained in:
		| @ -1,6 +1,8 @@ | ||||
| //! Provide Interface for worker services to handle signals | ||||
|  | ||||
| #[cfg(not(target_os = "windows"))] | ||||
| use futures::StreamExt; | ||||
| #[cfg(not(target_os = "windows"))] | ||||
| use router_env::logger; | ||||
| use tokio::sync::mpsc; | ||||
|  | ||||
| @ -8,6 +10,7 @@ use tokio::sync::mpsc; | ||||
| /// This functions is meant to run in parallel to the application. | ||||
| /// It will send a signal to the receiver when a SIGTERM or SIGINT is received | ||||
| /// | ||||
| #[cfg(not(target_os = "windows"))] | ||||
| pub async fn signal_handler(mut sig: signal_hook_tokio::Signals, sender: mpsc::Sender<()>) { | ||||
|     if let Some(signal) = sig.next().await { | ||||
|         logger::info!( | ||||
| @ -31,9 +34,47 @@ pub async fn signal_handler(mut sig: signal_hook_tokio::Signals, sender: mpsc::S | ||||
|     } | ||||
| } | ||||
|  | ||||
| /// | ||||
| /// This functions is meant to run in parallel to the application. | ||||
| /// It will send a signal to the receiver when a SIGTERM or SIGINT is received | ||||
| /// | ||||
| #[cfg(target_os = "windows")] | ||||
| pub async fn signal_handler(_sig: DummySignal, _sender: mpsc::Sender<()>) {} | ||||
|  | ||||
| /// | ||||
| /// This function is used to generate a list of signals that the signal_handler should listen for | ||||
| /// | ||||
| #[cfg(not(target_os = "windows"))] | ||||
| pub fn get_allowed_signals() -> Result<signal_hook_tokio::SignalsInfo, std::io::Error> { | ||||
|     signal_hook_tokio::Signals::new([signal_hook::consts::SIGTERM, signal_hook::consts::SIGINT]) | ||||
| } | ||||
|  | ||||
| /// | ||||
| /// This function is used to generate a list of signals that the signal_handler should listen for | ||||
| /// | ||||
| #[cfg(target_os = "windows")] | ||||
| pub fn get_allowed_signals() -> Result<DummySignal, std::io::Error> { | ||||
|     Ok(DummySignal) | ||||
| } | ||||
|  | ||||
| /// | ||||
| /// Dummy Signal Handler for windows | ||||
| /// | ||||
| #[cfg(target_os = "windows")] | ||||
| #[derive(Debug, Clone)] | ||||
| pub struct DummySignal; | ||||
|  | ||||
| #[cfg(target_os = "windows")] | ||||
| impl DummySignal { | ||||
|     /// | ||||
|     /// Dummy handler for signals in windows (empty) | ||||
|     /// | ||||
|     pub fn handle(&self) -> Self { | ||||
|         self.clone() | ||||
|     } | ||||
|  | ||||
|     /// | ||||
|     /// Hollow implementation, for windows compatibility | ||||
|     /// | ||||
|     pub fn close(self) {} | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jeeva
					Jeeva