Hi, I have a function that generates a tile for a google map overlay and writes it to disc so later requests can simply use the file. Due the nature of the map, generating the tiles previous is not a option so it has to be done on demand, which works nice on the developer server but not on apache. There are many requests for tiles and the calculation is expensive, so I want to limit apache to only generate one tile at the time.
I used something like this: from threading import Semaphore # create Basemap instance. Use 'crude' resolution coastlines. GENSEM = Semaphore(settings.TOPO_MAX_TILE_THREADS) def get_topoimg(request): ... def gen(): print "Lock GENSEM" GENSEM.acquire() topoimg(x, y, zoom, typ, name, rstate) GENSEM.release() print "Unlock GENSEM" return True rv = return_cached_file(name, gen, rebuild=False) ... TOPO_MAX_TILE_THREADS is 1 In developing mode and apache2 -X the Semaphore seems to work. If topoimg raises a exception, the next request hangs. But in normal apache mode the semaphore doesn't seem to have any affect, causing very high load on the machine. What am I doing wrong ? kindly regards Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---