How to avoid flooding kicks - 18/09/19 07:14 AM
Hi Everyone,
I have a bot that can output a lot of data and at times and it must hit the SENDQ max and the bot is killed.
Is there a way to buffer the output to avoid this. I have tried using a timer to actually do the output but I still get kicked. Maybe there is another way to do this, I am not sure.
Here is my sample code:
Hopefully someone has encountered this before and has a solution.
I have a bot that can output a lot of data and at times and it must hit the SENDQ max and the bot is killed.
Is there a way to buffer the output to avoid this. I have tried using a timer to actually do the output but I still get kicked. Maybe there is another way to do this, I am not sure.
Here is my sample code:
Code
alias Test { var %data = The quick brown fox jumps over the lazy dog var %count = 500 var %index = 1 if ($hget(buffer.data)) hfree buffer.data hmake buffer.data 1 clear while (%index <= %count) { hadd buffer.data %index %data inc %index } noop $OutputBuffer(buffer.data, #chill) } alias OutputBuffer { set %OutputBuffer.Count $hget($1, 0).item set %OutputBuffer.Bytes 0 TimedOutput $1 $2 .timerOutput -q 0 2 TimedOutput $1 $2 } alias TimedOutput { while (%OutputBuffer.Count > 0) { var %data = $hget($1, %OutputBuffer.Count).data -> %OutputBuffer.Bytes %OutputBuffer.Bytes = $calc(%OutputBuffer.Bytes + $len(%data)) msg $2 %data dec %OutputBuffer.Count if (%OutputBuffer.Bytes > 511) { set %OutputBuffer.Bytes 0 return } if (%OutputBuffer.Count < 1) .timerOutput -q off } }
Hopefully someone has encountered this before and has a solution.