async extract for ZipFile
1 min readSep 14, 2017
總之就是個 polyfill.
((最近在改版的時候用到的…用了 ws 就很想順便換成 sanic… 這樣 SubprocessExecutorPool 就可以退役惹QQ
async_extractall
會有 racing condition ,因為 extract
裡是這樣寫的:
# Create all upper directories if necessary.
upperdirs = os.path.dirname(targetpath)
if upperdirs and not os.path.exists(upperdirs):
os.makedirs(upperdirs)
在 concurrency 的時候有蠻高的機率會撞到(and raise FileExistsError),解法很簡單,再跑一次就好惹。(that’s why gather
twice.)
joy john bye~