Преглед изворни кода

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

Beoran пре 7 година
родитељ
комит
789fb47da9
1 измењених фајлова са 2 додато и 0 уклоњено
  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
 }