Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
ihucos committed Mar 7, 2021
1 parent 3f76a1c commit 1a6a15a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"
"path/filepath"
"strings"
"time"
)

type UserDump struct {
Expand Down Expand Up @@ -344,6 +345,12 @@ func (ctx *Ctx) handleDump() {
// with two many dumb pushs. TODO: throttle it to something around max
// ~2 pers seconds.
//

// DOING THE ABOVE COMMENT FOR HACKER NEWS: rework this!


lastDump := time.Now()

user.HandleSignals(conn, func(err error) {

// this happens because we close the connection to redis when
Expand All @@ -354,6 +361,10 @@ func (ctx *Ctx) handleDump() {
}

ctx.CatchError(err)
sendDump()

if time.Since(lastDump) > time.Second * 1 {
sendDump()
lastDump = time.Now()
}
})
}

0 comments on commit 1a6a15a

Please sign in to comment.