<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18232" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2011-01-08T14:03:25-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18232</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2011-01-08T14:03:25-04:00</updated>

		<published>2011-01-08T14:03:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95586#p95586</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95586#p95586"/>
		<title type="html"><![CDATA[how to have multi-thread processing..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95586#p95586"><![CDATA[
The trick here, is to use the event-engine in tcl, along with your own queues...<br>As you thought, the rough idea is: since each of your searches are fast in nature, store the results as lists, one for each user, which each song title as a separate list item.<br>Then have an event-driven function/proc poll these lists for new data to send to each user, only picking one list item for each user during each iteration. This way, all users will get their results at the same rate.<br><div class="codebox"><p>Code: </p><pre><code>proc doSearch {....} {#some code to get the list of results here...#assuming $result is a list of results, and $nick is the nickname of the requester...  if {![info exists ::responseQueue($nick)]} {    set ::responseQueue($nick) $result  } {    set ::responseQueue($nick) [concat $::responseQueue($nick) $result]  }}proc poll {} {  foreach nick [array names ::responseQueue] {    if {[llength $::responseQueue($nick)] &gt; 0} {      #pop the first value off the list..      set item [lindex $::responseQueue($nick) 0]      set ::responseQueue($nick) [lrange $::responseQueue($nick) 1 end]      #and send to the user      puthelp "PRIVMSG $nick :$item"    }  }  #Trigger a new event after 1000 ms  after 1000 poll}#start the polling...poll</code></pre></div>Keep in mind, that this code currently does no checks for nickname changes or such, though that could be fairly easily solved by renaming the array index accordingly.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Jan 08, 2011 2:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2011-01-08T10:15:10-04:00</updated>

		<published>2011-01-08T10:15:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95584#p95584</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95584#p95584"/>
		<title type="html"><![CDATA[how to have multi-thread processing..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95584#p95584"><![CDATA[
Check out:<br><a href="http://eggwiki.org/Eggdrop.conf" class="postlink">http://eggwiki.org/Eggdrop.conf</a><br>and scroll down to:<blockquote class="uncited"><div># Number of seconds to wait between transmitting queued lines to the server.<br> # Lower this value at your own risk.  ircd is known to start flood control<br> # at 512 bytes/2 seconds.<br> set msg-rate 2</div></blockquote>Next, check out:<br><a href="http://www.eggheads.org/support/egghtml/1.6.20/tcl-commands.html" class="postlink">http://www.eggheads.org/support/egghtml ... mands.html</a><br>and scroll down to:<br>putnow<br><br>Again, I hope this is somehow helpful<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sat Jan 08, 2011 10:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2011-01-08T09:55:16-04:00</updated>

		<published>2011-01-08T09:55:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95583#p95583</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95583#p95583"/>
		<title type="html"><![CDATA[Re: how to have multi-thread processing..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95583#p95583"><![CDATA[
<blockquote class="uncited"><div><br>...<br>user one will get his list right away, user two will also get his list realitively quickly, but user 3 will not get ANYTHING untill user 2's list finishes displaying..   although the  logic, internally, is quick.. the "having to write it all out to the server" really SLOWS DOWN the entire process.. and since  "beatles" will render over 100 items, user three will most likely GIVE UP before he waits out 2 to 5 MINUTES for his list!<br>...</div></blockquote><br>I've read that Eggdrop is designed to NOT flood itself off a server.  That is, to not suddenly dump a lot of stuff, such that the server detects it as a flood, and kicks the bot off.<br><br>From what you've described, to me it sounds like you've 'discovered' this.<br><br>If you really want to get around this, I have read about it, right here in this forum.  I believe I read about methods to get around it.... but one must realize what one is asking for...  the potential to get one's bot kicked off.<br><br>I'm replying without first searching the forum, so I can't give you a link to a specific thread.  <br><br>I hope this helps somehow though.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Sat Jan 08, 2011 9:55 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Trixar_za]]></name></author>
		<updated>2011-01-08T05:27:03-04:00</updated>

		<published>2011-01-08T05:27:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95581#p95581</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95581#p95581"/>
		<title type="html"><![CDATA[how to have multi-thread processing..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95581#p95581"><![CDATA[
Well, TCL is technically not designed to be threaded at all which is probably where the trouble comes in. I have noticed the same problem with some of my scripts, especially those that have to send more than 4 lines over notice that it really slows down the whole bot. My fix for it was to use putquick PRIVMSG instead of NOTICE to help speed things up. Not exactly sure why this works, but it does. Maybe you could make it output to private if the results are more than 5 lines long?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10958">Trixar_za</a> — Sat Jan 08, 2011 5:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2011-01-08T03:20:23-04:00</updated>

		<published>2011-01-08T03:20:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95580#p95580</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95580#p95580"/>
		<title type="html"><![CDATA[how to have multi-thread processing..]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95580#p95580"><![CDATA[
This ones going to be kinda hard to explain, but I will try to explain through an example..<br><br>The situation:<br><br>an eggdrop sitting in a busy chatroom..  many users sending it commands all at the same time.<br><br>the commands are sent in a msg window, which require the bot to reply with a list- varable length/size<br><br>The problem:<br><br>user one sends a query for "tainted love" ,<br>user two sends a query for "beatles"<br>user three sends a query for "all throghh the night"<br><br>user one will get his list right away, user two will also get his list realitively quickly, but user 3 will not get ANYTHING untill user 2's list finishes displaying..   although the  logic, internally, is quick.. the "having to write it all out to the server" really SLOWS DOWN the entire process.. and since  "beatles" will render over 100 items, user three will most likely GIVE UP before he waits out 2 to 5 MINUTES for his list!<br><br>I have set a limit to 20 items- but theres still a realitively long wait time  which woud double for each user past the previous...  and, the limit also cuts off a possale querry for "item 21" and beyond... (an undesired side-effect)<br><br>the solution:<br><br>As I mentioned above, the logic itself is realitively fast- but the writing out to the server is what takes the time.. so if there was a way to "seperate", isolate or "multi-thread" the server write-out process.. so that each user gets his list at the same time as each other user.. this could work very nicely!<br><br>unless someone has a better idea how I can do this, <br><br>some things to note:<br><br>The database is *NOT* mysql or any form of established database- it is managed by a playout system and prepriortary to it.. it can ONLY be accessed through a web-channel (done internally) where its cached in a varable and parsed.. <br><br>query:<br>!search &lt;song/artsit&gt; -&gt; "arg"<br>socket -&gt; push command $arg -&gt; localhost -&gt; webserver -&gt; playout<br><br>return:<br>Playout -&gt; webserver -&gt; localhost-&gt; eggdrop -&gt; socket -&gt; "GetInfo"<br>GetInfo -&gt; parsers -&gt; "Song", "Show", "DJ", (etc) -&gt; putserv $nick $song1, Song 2, etc"<br><br>each result (song 1, song 2, etc) is a new write to putserv<br><br>I could display the code, but its really "involved" I don't want to post it "freely" however since it contains "sensitive elements" and if I remove/substitute said elements, the code wouldn't make sense.. also, the code resides on an entirely-different machine which does NOT contain a browser or any way to access the web.. I'd have to use "sneakernet" to gain the file  I won't do the work if it won't be seriously-considered <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>-DjZ<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10318">dj-zath</a> — Sat Jan 08, 2011 3:20 am</p><hr />
]]></content>
	</entry>
	</feed>
