瀏覽代碼

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
 }