mirror of
https://github.com/statbate/special-pancake.git
synced 2026-08-11 03:12:42 +00:00
update timeout and buffer size
This commit is contained in:
parent
fbbe4921c9
commit
926814260d
2 changed files with 7 additions and 4 deletions
10
app/main.go
10
app/main.go
|
|
@ -28,10 +28,10 @@ var (
|
||||||
|
|
||||||
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
json = jsoniter.ConfigCompatibleWithStandardLibrary
|
||||||
|
|
||||||
socketServer = make(chan []byte, 100)
|
socketServer = make(chan []byte, 1)
|
||||||
|
|
||||||
save = make(chan saveData, 100)
|
save = make(chan saveData, 1)
|
||||||
slog = make(chan saveLog, 100)
|
slog = make(chan saveLog, 32)
|
||||||
|
|
||||||
rooms = &Rooms{
|
rooms = &Rooms{
|
||||||
Count: make(chan int),
|
Count: make(chan int),
|
||||||
|
|
@ -99,8 +99,10 @@ func socketHandler() {
|
||||||
select {
|
select {
|
||||||
case b := <-socketServer:
|
case b := <-socketServer:
|
||||||
|
|
||||||
|
//fmt.Println("socketServer", len(socketServer), cap(socketServer))
|
||||||
|
|
||||||
if conn == nil || conn.RemoteAddr() == nil {
|
if conn == nil || conn.RemoteAddr() == nil {
|
||||||
conn, err = net.DialTimeout("unix", "/tmp/echo.sock", time.Second*5)
|
conn, err = net.DialTimeout("unix", "/tmp/echo.sock", time.Millisecond*10)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,7 @@ func saveLogs() {
|
||||||
bulk = nil
|
bulk = nil
|
||||||
}
|
}
|
||||||
case m := <-slog:
|
case m := <-slog:
|
||||||
|
//fmt.Println("slog", len(slog), cap(slog))
|
||||||
if len(m.Mes) > 0 {
|
if len(m.Mes) > 0 {
|
||||||
bulk = append(bulk, m)
|
bulk = append(bulk, m)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue