Skip to content

Commit b6dc197

Browse files
author
Antonio Cheong
committed
Remove debug
1 parent 7de4c2f commit b6dc197

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

handlers/api.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ func API_ask(c *gin.Context) {
7474
// Find connection with the lowest load and where heartbeat is after last message time
7575
connectionPool.Mu.RLock()
7676
for _, conn := range connectionPool.Connections {
77-
println(conn.Id)
7877
if connection == nil || conn.LastMessageTime.Before(connection.LastMessageTime) {
7978
if conn.Heartbeat.After(conn.LastMessageTime) {
8079
connection = conn
@@ -90,17 +89,14 @@ func API_ask(c *gin.Context) {
9089
return
9190
}
9291
// Ping before sending request
93-
println(connection.Id)
9492
var pingSucceeded bool = ping(connection.Id)
9593
if !pingSucceeded {
9694
// Ping failed. Try again
9795
connectionPool.Delete(connection.Id)
98-
println("Ping failed")
9996
succeeded = false
10097
connection = nil
10198
continue
10299
} else {
103-
println("Ping succeeded")
104100
succeeded = true
105101
break
106102
}
@@ -224,7 +220,6 @@ func API_getConnections(c *gin.Context) {
224220
}
225221

226222
func ping(connection_id string) bool {
227-
println("Starting ping")
228223
// Get connection
229224
connection, ok := connectionPool.Get(connection_id)
230225
// Send "ping" to the connection
@@ -236,7 +231,6 @@ func ping(connection_id string) bool {
236231
}
237232
connection.Ws.SetReadDeadline(time.Now().Add(5 * time.Second))
238233
err := connection.Ws.WriteJSON(send)
239-
println("Sent ping")
240234
if err != nil {
241235
return false
242236
}
@@ -245,9 +239,7 @@ func ping(connection_id string) bool {
245239
// Read message
246240
var receive types.Message
247241
err = connection.Ws.ReadJSON(&receive)
248-
println("Received ping response")
249242
if err != nil {
250-
println("There was an error")
251243
return false
252244
}
253245
// Check if the message is the response

0 commit comments

Comments
 (0)