0

chunk generation checks mtime before hashing block array

This commit is contained in:
Andrew Brown
2010-09-11 19:06:32 -04:00
parent 07d6df1cbe
commit 5726f7e23e
3 changed files with 91 additions and 31 deletions

View File

@@ -67,6 +67,23 @@ def render_chunks_async(chunks, caves, processes):
Returns a dictionary mapping (chunkx, chunky) to a
multiprocessing.pool.AsyncResult object
"""
if processes == 1:
# Skip the multiprocessing stuff
print "Rendering chunks synchronously since you requested 1 process"
class MyResult(object):
pass
resultsmap = {}
for i, (chunkx, chunky, chunkfile) in enumerate(chunks):
result = chunk.render_and_save(chunkfile, cave=caves)
print "{0}/{1} chunks rendered".format(i, len(chunks))
resultobj = MyResult()
resultobj.get = lambda: result
resultsmap[(chunkx, chunky)] = resultobj
if i == 6:
import sys
sys.exit(0)
return resultsmap
pool = multiprocessing.Pool(processes=processes)
resultsmap = {}
for chunkx, chunky, chunkfile in chunks: