It is also one of the things I miss while coding in Django.
What's this have to do with Facebook apps?
Every call to the FB API costs time - from 280ms to 475ms on average - and the more calls, the more time. Where submitting some work really comes in handy is during processing after a user-gesture. Want to publish a bunch of news after the user clicks "BITE ME" and not have the user sit there and wait (and maybe experience an FB timeout) while you send minifeed news and notifications to
Use a thread. Really, use a threadpool, but I haven't coded mine yet. It doesn't take long to code, but the holidays grabbed me around the ankle and forced me to take time with friends, so there you go.
But the basics are here:
def sbmthrjob(cmd, *args):
def __init__(self, cmd, *args):
self.cmd = cmd
self.args = args
thread1 = newThread(cmd, *args)
except Exception, e:
print 'sbmjob exception: ' , e
sbmthrjob(cmd, argle, bargle)
What I want to do is to have the thread come from a pool of already-created threads - I'll get to that soon.