File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ module.exports = class IrcClient extends EventEmitter {
5757 sasl_disconnect_on_fail : false ,
5858 transport : default_transport ,
5959 websocket_protocol : 'text.ircv3.net' ,
60- serialize_writes : false
60+ serialize_writes : false ,
61+ serialized_writes_flood_protect_ms : 100
6162 } ;
6263
6364 const props = Object . keys ( defaults ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ const SOCK_DISCONNECTED = 0;
1414const SOCK_CONNECTING = 1 ;
1515const SOCK_CONNECTED = 2 ;
1616
17+ const FLOOD_PROTECT_WAIT_MS = 100 ;
18+
1719module . exports = class Connection extends EventEmitter {
1820 constructor ( options ) {
1921 super ( ) ;
@@ -91,6 +93,7 @@ module.exports = class Connection extends EventEmitter {
9193 this . incoming_buffer = Buffer . from ( '' ) ;
9294
9395 if ( options . serialize_writes ) {
96+ const flood_protect_wait_ms = options . serialized_writes_flood_protect_ms || FLOOD_PROTECT_WAIT_MS ;
9497 this . write_queue = [ ] ;
9598 this . write_queue_servicer = ( ) => {
9699 if ( this . write_queue . length ) {
@@ -100,7 +103,7 @@ module.exports = class Connection extends EventEmitter {
100103 }
101104
102105 this . write_queue = this . write_queue . slice ( 1 ) ;
103- process . nextTick ( this . write_queue_servicer ) ;
106+ setTimeout ( this . write_queue_servicer , flood_protect_wait_ms ) ;
104107 } ) ;
105108 }
106109 } ;
You can’t perform that action at this time.
0 commit comments