mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 08:28:31 +00:00
Add ratelimits to publishing
This commit is contained in:
parent
b84bd1d4a2
commit
50e295c834
10 changed files with 260 additions and 103 deletions
|
@ -300,8 +300,8 @@ var CloseNonUTF8Data = websocket.CloseError{
|
|||
Text: "Non UTF8 data recieved. Network corruption likely.",
|
||||
}
|
||||
|
||||
const sendMessageBufferLength = 30
|
||||
const sendMessageAbortLength = 20
|
||||
const sendMessageBufferLength = 5
|
||||
const sendMessageAbortLength = 5
|
||||
|
||||
// RunSocketConnection contains the main run loop of a websocket connection.
|
||||
//
|
||||
|
@ -350,11 +350,8 @@ func RunSocketConnection(conn *websocket.Conn) {
|
|||
closeConnection(conn, closeReason)
|
||||
// closeConnection(conn, closeReason, &report)
|
||||
|
||||
// Launch message draining goroutine - we aren't out of the pub/sub records
|
||||
go func() {
|
||||
for _ = range _serverMessageChan {
|
||||
}
|
||||
}()
|
||||
// We can just drop serverMessageChan and let it be picked up by GC, because all sends are nonblocking.
|
||||
_serverMessageChan = nil
|
||||
|
||||
// Closes client.MsgChannelIsDone and also stops the reader thread
|
||||
close(stoppedChan)
|
||||
|
@ -364,11 +361,8 @@ func RunSocketConnection(conn *websocket.Conn) {
|
|||
|
||||
// Wait for pending jobs to finish...
|
||||
client.MsgChannelKeepalive.Wait()
|
||||
client.MessageChannel = nil
|
||||
|
||||
// And done.
|
||||
// Close the channel so the draining goroutine can finish, too.
|
||||
close(_serverMessageChan)
|
||||
|
||||
if !StopAcceptingConnections {
|
||||
// Don't perform high contention operations when server is closing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue