Skip to content
Snippets Groups Projects
Commit b9c90151 authored by zf4's avatar zf4
Browse files

temp data print

parent 1fcef832
No related branches found
No related tags found
No related merge requests found
......@@ -449,9 +449,12 @@ func handleWorkerConnection(conn net.Conn) {
if debugCount%10000 == 0 {
fmt.Println(debugCount)
}
tempNewLine := []interface{}{"\n"}
tempData = append(tempData, tempNewLine)
tempData = append(tempData, data.Tuple)
dataSaveMux.Lock()
tempData = append(tempData, data.Tuple...)
tempData = append(tempData, tempNewLine...)
dataSaveMux.Unlock()
//saveData(data.Tuple)
}
}
......@@ -466,7 +469,7 @@ func appendDataToFile(tuple []interface{}) {
}
defer f.Close()
for _, elem := range tuple {
tmpStr := fmt.Sprintf("%v\n", elem)
tmpStr := fmt.Sprintf("%v", elem)
if _, err = f.WriteString(tmpStr); err != nil {
fmt.Println(err)
}
......@@ -483,7 +486,7 @@ func saveTempData() {
}
defer f.Close()
for _, elem := range tempData {
tmpStr := fmt.Sprintf("%v\n", elem)
tmpStr := fmt.Sprintf("%v", elem)
if _, err = f.WriteString(tmpStr); err != nil {
fmt.Println(err)
}
......@@ -502,6 +505,15 @@ func SaveToFile() {
dataSaveMux.Unlock()
}
func PrintTempData() {
dataSaveMux.Lock()
for _, elem := range tempData {
tmpStr := fmt.Sprintf("%v", elem)
fmt.Println(tmpStr)
}
dataSaveMux.Unlock()
}
// ServerCleanup - shut down all conn to workers
func ServerCleanup() {
for _, conn := range workerConn {
......
......@@ -126,6 +126,14 @@ func HandleServerCommand(cmd string) {
fmt.Println("This is not a master")
}
}
case "print-temp":
{
if craneType == 2 {
crane.PrintTempData()
} else {
fmt.Println("This is not a master")
}
}
default:
println("Invalid Command")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment