mirror of
https://github.com/statbate/special-pancake.git
synced 2026-08-11 03:12:42 +00:00
Update worker.go
This commit is contained in:
parent
a61a521dd3
commit
f8a794b9e1
1 changed files with 5 additions and 1 deletions
|
|
@ -173,6 +173,8 @@ func xWorker(workerData Info, u url.URL) {
|
||||||
defer leave.Stop()
|
defer leave.Stop()
|
||||||
|
|
||||||
isLeave := false
|
isLeave := false
|
||||||
|
var income int64
|
||||||
|
income = 0
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
|
||||||
|
|
@ -193,7 +195,7 @@ func xWorker(workerData Info, u url.URL) {
|
||||||
_, message, err := c.ReadMessage()
|
_, message, err := c.ReadMessage()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err.Error(), workerData.room)
|
fmt.Println(err.Error(), workerData.room)
|
||||||
if workerData.Income > 1 && websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {
|
if income > 1 && websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway) {
|
||||||
go reconnectRoom(workerData)
|
go reconnectRoom(workerData)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
|
@ -291,6 +293,8 @@ func xWorker(workerData Info, u url.URL) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
income += donate.Amount
|
||||||
|
|
||||||
if isLeave {
|
if isLeave {
|
||||||
leave.Reset(60 * 10 * time.Second)
|
leave.Reset(60 * 10 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue