git » msnlib » commit b029f32

Remove useless sleep() from msnbot's main loop

author Alberto Bertogli
2008-06-21 00:03:38 UTC
committer Alberto Bertogli
2008-06-21 00:10:38 UTC
parent 6ecf38256c9baa909fa7926b51b1733b0182fa0b

Remove useless sleep() from msnbot's main loop

Because the select() blocks until a fd is available, there is no need for
the time.sleep(). I think it's just a leftover from older code, wrongly
copied.

Also, remove the unneeded timeout select() parameter, and fix some crappy
whitespace.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

utils/msnbot +5 -8

diff --git a/utils/msnbot b/utils/msnbot
index 001d2d1..cd20735 100755
--- a/utils/msnbot
+++ b/utils/msnbot
@@ -37,11 +37,11 @@ def do_work():
 	Here you do your stuff and send messages using m.sendmsg()
 	This is the only place your code lives
 	"""
-	
+
 	# wait a bit for everything to settle down (sync taking efect
 	# basically)
 	time.sleep(15)
-	
+
 	print '-' * 20 + 'SEND 1'
 	print m.sendmsg("xx@me.com", "Message One")
 
@@ -53,7 +53,7 @@ def do_work():
 
 	# and then quit
 	quit()
-	
+
 
 # you shouldn't need to touch anything past here
 
@@ -104,10 +104,10 @@ while 1:
 
 	# we select, waiting for events
 	try:
-		fds = select.select(infd, outfd, [], 0)
+		fds = select.select(infd, outfd, [])
 	except:
 		quit()
-	
+
 	for i in fds[0] + fds[1]:       # see msnlib.msnd.pollable.__doc__
 		try:
 			m.read(i)
@@ -120,8 +120,5 @@ while 1:
 				# main socket closed
 				quit()
 
-	# sleep a bit so we don't take over the cpu
-	time.sleep(0.01)
-