Browse Source

Use runtime.Gosched() to lessen server CPU load somewhat.

Beoran 7 years ago
parent
commit
789fb47da9
1 changed files with 2 additions and 0 deletions
  1. 2 0
      server/server.go

+ 2 - 0
server/server.go

@@ -8,6 +8,7 @@ import (
 	"math/rand"
 	"os"
 	"path/filepath"
+	"runtime"
 	"time"
 
 	"github.com/beoran/woe/monolog"
@@ -287,6 +288,7 @@ func (me *Server) Serve() (status int, err error) {
 		} else {
 			go me.onConnect(conn)
 		}
+		runtime.Gosched()
 	}
 	return me.exitstatus, nil
 }