mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	hacking around
This commit is contained in:
		@@ -88,6 +88,7 @@ namespace Ocelot.Raft
 | 
				
			|||||||
        public Response<T> Request<T>(T command)
 | 
					        public Response<T> Request<T>(T command)
 | 
				
			||||||
            where T : ICommand
 | 
					            where T : ICommand
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            Console.WriteLine("SENDING REQUEST....");
 | 
				
			||||||
            if(_token == null)
 | 
					            if(_token == null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                SetToken();
 | 
					                SetToken();
 | 
				
			||||||
@@ -99,11 +100,13 @@ namespace Ocelot.Raft
 | 
				
			|||||||
            var response = _httpClient.PostAsync($"{_hostAndPort}/administration/raft/command", content).GetAwaiter().GetResult();
 | 
					            var response = _httpClient.PostAsync($"{_hostAndPort}/administration/raft/command", content).GetAwaiter().GetResult();
 | 
				
			||||||
            if(response.IsSuccessStatusCode)
 | 
					            if(response.IsSuccessStatusCode)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                Console.WriteLine("REQUEST OK....");
 | 
				
			||||||
                var okResponse = JsonConvert.DeserializeObject<OkResponse<ICommand>>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), _jsonSerializerSettings);
 | 
					                var okResponse = JsonConvert.DeserializeObject<OkResponse<ICommand>>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), _jsonSerializerSettings);
 | 
				
			||||||
                return new OkResponse<T>((T)okResponse.Command);
 | 
					                return new OkResponse<T>((T)okResponse.Command);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else 
 | 
					            else 
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                Console.WriteLine("REQUEST NOT OK....");
 | 
				
			||||||
                return new ErrorResponse<T>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), command);
 | 
					                return new ErrorResponse<T>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), command);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -105,6 +105,7 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
            GivenFiveServersAreRunning();
 | 
					            GivenFiveServersAreRunning();
 | 
				
			||||||
            GivenIHaveAnOcelotToken("/administration");
 | 
					            GivenIHaveAnOcelotToken("/administration");
 | 
				
			||||||
            WhenISendACommandIntoTheCluster(command);
 | 
					            WhenISendACommandIntoTheCluster(command);
 | 
				
			||||||
 | 
					            Thread.Sleep(5000);
 | 
				
			||||||
            ThenTheCommandIsReplicatedToAllStateMachines(command);
 | 
					            ThenTheCommandIsReplicatedToAllStateMachines(command);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -261,8 +262,8 @@ namespace Ocelot.IntegrationTests
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
                catch(Exception e)
 | 
					                catch(Exception e)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    _output.WriteLine($"{e.Message}, {e.StackTrace}");
 | 
					                    //_output.WriteLine($"{e.Message}, {e.StackTrace}");
 | 
				
			||||||
                    Console.WriteLine(e);
 | 
					                    //Console.WriteLine(e);
 | 
				
			||||||
                    return false;
 | 
					                    return false;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user