Pretend a string is an AsyncResult
This commit is contained in:
8
world.py
8
world.py
@@ -87,6 +87,12 @@ def base36encode(number, alphabet='0123456789abcdefghijklmnopqrstuvwxyz'):
|
|||||||
return "-" + base36
|
return "-" + base36
|
||||||
return base36
|
return base36
|
||||||
|
|
||||||
|
class FakeAsyncResult:
|
||||||
|
def __init__(self, string):
|
||||||
|
self.string = string
|
||||||
|
def get(self):
|
||||||
|
return self.string
|
||||||
|
|
||||||
class WorldRenderer(object):
|
class WorldRenderer(object):
|
||||||
"""Renders a world's worth of chunks.
|
"""Renders a world's worth of chunks.
|
||||||
worlddir is the path to the minecraft world
|
worlddir is the path to the minecraft world
|
||||||
@@ -326,7 +332,7 @@ class WorldRenderer(object):
|
|||||||
|
|
||||||
oldimg = chunk.find_oldimage(chunkfile, cached, self.caves)
|
oldimg = chunk.find_oldimage(chunkfile, cached, self.caves)
|
||||||
if oldimg[1] and (os.path.getmtime(chunkfile) <= os.path.getmtime(oldimg[1])):
|
if oldimg[1] and (os.path.getmtime(chunkfile) <= os.path.getmtime(oldimg[1])):
|
||||||
result = oldimg[1]
|
result = FakeAsyncResult(oldimg[1])
|
||||||
else:
|
else:
|
||||||
result = pool.apply_async(chunk.render_and_save,
|
result = pool.apply_async(chunk.render_and_save,
|
||||||
args=(chunkfile,self.cachedir,self, oldimg),
|
args=(chunkfile,self.cachedir,self, oldimg),
|
||||||
|
|||||||
Reference in New Issue
Block a user