Fix memory leak in secondary, cleanup code.
This commit is contained in:
		| @@ -12,7 +12,6 @@ const ( | ||||
| 	pathStreamWAL = "stream-wal" | ||||
| ) | ||||
|  | ||||
| // TODO: Remove this! | ||||
| func (rep *Replicator) Handle(w http.ResponseWriter, r *http.Request) { | ||||
| 	// We'll handle two types of requests: HTTP GET requests for JSON, or | ||||
| 	// streaming requets for state or wall. | ||||
|   | ||||
							
								
								
									
										11
									
								
								lib/rep/main_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/rep/main_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| package rep | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
|  | ||||
| 	"go.uber.org/goleak" | ||||
| ) | ||||
|  | ||||
| func TestMain(m *testing.M) { | ||||
| 	goleak.VerifyTestMain(m) | ||||
| } | ||||
| @@ -36,8 +36,8 @@ type App struct { | ||||
| 	// SendState: The primary may need to send storage state to a secondary node. | ||||
| 	SendState func(conn net.Conn) error | ||||
|  | ||||
| 	// (1) RecvState: Secondary nodes may need to load state from the primary if the | ||||
| 	// WAL is too far behind. | ||||
| 	// (1) RecvState: Secondary nodes may need to load state from the primary if | ||||
| 	// the WAL is too far behind. | ||||
| 	RecvState func(conn net.Conn) error | ||||
|  | ||||
| 	// (2) InitStorage: Prepare application storage for possible calls to | ||||
|   | ||||
| @@ -56,6 +56,7 @@ func (h TestAppHarness) Run(t *testing.T) { | ||||
| 				WALSegMaxAgeSec: 1, | ||||
| 				WALSegGCAgeSec:  1, | ||||
| 			}) | ||||
| 			defer app2.Close() | ||||
|  | ||||
| 			val.MethodByName(method.Name).Call([]reflect.Value{ | ||||
| 				reflect.ValueOf(t), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user