mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-10-31 18:17:13 +08:00 
			
		
		
		
	feat(router): add configuration support for actix workers (#156)
This commit is contained in:
		
							
								
								
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							| @ -2734,6 +2734,7 @@ dependencies = [ | |||||||
|  "mimalloc", |  "mimalloc", | ||||||
|  "mime", |  "mime", | ||||||
|  "nanoid", |  "nanoid", | ||||||
|  |  "num_cpus", | ||||||
|  "once_cell", |  "once_cell", | ||||||
|  "rand", |  "rand", | ||||||
|  "redis_interface", |  "redis_interface", | ||||||
|  | |||||||
| @ -48,7 +48,7 @@ locker_decryption_key2 = "" | |||||||
| host = "redis-queue" | host = "redis-queue" | ||||||
| port = 6379 | port = 6379 | ||||||
| cluster_enabled = true | cluster_enabled = true | ||||||
| cluster_urls = ["bach-redis-queue-1:6379", "bach-redis-queue-2:6379", "bach-redis-queue-3:6379"] | cluster_urls = ["redis-queue:6379"] | ||||||
|  |  | ||||||
| [connectors.aci] | [connectors.aci] | ||||||
| base_url = "https://eu-test.oppwa.com/" | base_url = "https://eu-test.oppwa.com/" | ||||||
|  | |||||||
| @ -48,6 +48,7 @@ maud = { version = "0.24", features = ["actix-web"] } | |||||||
| mimalloc = { version = "0.1", optional = true } | mimalloc = { version = "0.1", optional = true } | ||||||
| mime = "0.3.16" | mime = "0.3.16" | ||||||
| nanoid = "0.4.0" | nanoid = "0.4.0" | ||||||
|  | num_cpus = "1.14.0" | ||||||
| once_cell = "1.16.0" | once_cell = "1.16.0" | ||||||
| rand = "0.8.5" | rand = "0.8.5" | ||||||
| reqwest = { version = "0.11.12", features = ["json", "native-tls"] } | reqwest = { version = "0.11.12", features = ["json", "native-tls"] } | ||||||
|  | |||||||
| @ -84,6 +84,7 @@ pub struct Proxy { | |||||||
| #[derive(Debug, Deserialize, Clone)] | #[derive(Debug, Deserialize, Clone)] | ||||||
| pub struct Server { | pub struct Server { | ||||||
|     pub port: u16, |     pub port: u16, | ||||||
|  |     pub workers: Option<usize>, | ||||||
|     pub host: String, |     pub host: String, | ||||||
|     pub request_body_limit: usize, |     pub request_body_limit: usize, | ||||||
|     pub base_url: String, |     pub base_url: String, | ||||||
|  | |||||||
| @ -133,6 +133,7 @@ pub async fn start_server(conf: Settings) -> BachResult<(Server, AppState)> { | |||||||
|     let request_body_limit = server.request_body_limit; |     let request_body_limit = server.request_body_limit; | ||||||
|     let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit)) |     let server = actix_web::HttpServer::new(move || mk_app(state.clone(), request_body_limit)) | ||||||
|         .bind((server.host.as_str(), server.port))? |         .bind((server.host.as_str(), server.port))? | ||||||
|  |         .workers(server.workers.unwrap_or_else(num_cpus::get_physical)) | ||||||
|         .run(); |         .run(); | ||||||
|  |  | ||||||
|     Ok((server, app_state)) |     Ok((server, app_state)) | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ services: | |||||||
|   loki: |   loki: | ||||||
|     image: grafana/loki:latest |     image: grafana/loki:latest | ||||||
|     ports: |     ports: | ||||||
|       - "3100:3100" |       - "3100" | ||||||
|     command: -config.file=/etc/loki/loki.yaml |     command: -config.file=/etc/loki/loki.yaml | ||||||
|     networks: |     networks: | ||||||
|       - router_net |       - router_net | ||||||
| @ -66,7 +66,7 @@ services: | |||||||
|   pg: |   pg: | ||||||
|     image: postgres:14.5 |     image: postgres:14.5 | ||||||
|     ports: |     ports: | ||||||
|       - "5432:5432" |       - "5432" | ||||||
|     networks: |     networks: | ||||||
|       - router_net |       - router_net | ||||||
|     volumes: |     volumes: | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Sampras Lopes
					Sampras Lopes