async extract for ZipFile

總之就是個 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~

Like what you read? Give 貓橘毛 a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.