GoCubs Wrote: > Ian- > I haven't walked through your code, but have you looked into using > Slim::Networking::SimpleAsyncHTTP? On my SuperDateTime plugin some > people were experiencing server freezes during the HTTP calls and > somoene suggested I use it. It does HTTP calls in the background > ideally when SlimServer isn't busy doing anything else. I'm not sure > if it'd work with what you're doing, but it definately helped in my > case. >
I actually wrote something much like SimpleAsyncHTTP; it's called BackgroundHTTP and you can find it in the SlimScrobbleSupport directory. I must have written it at about the same time as SAHTTP appeared - I looked around the server code for any examples of async HTTP, didn't find any, wrote my own over a couple of weeks, and then looked again and found SAHTTP. Bah! That'll teach me to not talk to anyone about what I'm doing :) Removing mine and using SAHTTP is on the list of things to do. Last time I checked though SAHTTP would need some changes to work with the Scrobbler; I need control over the useragent string, and SAHTTP still used blocking DNS calls. These might have been done by now, I don't know. Still, moving to SAHTTP should give slightly better performance and they might just have solved this blocking on the initial connect. (If anyone does know anything about Perl networking, BackgroundHTTP appears to block during Net::HTTP::NB->new(). What's more, this call doesn't always seem to honour the timeout that its passed. AIUI this call does a TCP-level connect - BHTTP will have already done a DNS lookup using non-blocking Net::DNS, and the actual HTTP request doesn't get sent until after the new() has returned. This stuff nearly drove me mad when I was looking at it a few months back) Ian -- iwp ------------------------------------------------------------------------ iwp's Profile: http://forums.slimdevices.com/member.php?userid=409 View this thread: http://forums.slimdevices.com/showthread.php?t=18305 _______________________________________________ plugins mailing list [email protected] http://lists.slimdevices.com/lists/listinfo/plugins
