Explorar o código

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

Beoran %!s(int64=7) %!d(string=hai) anos
pai
achega
789fb47da9
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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
 }