function to get unique file queues for any type of base queue

This commit is contained in:
Vostretsov Nikita 2018-11-20 16:13:09 +00:00
parent 886513c375
commit a25cf5c82f
1 changed files with 15 additions and 0 deletions

15
scrapy/core/queues.py Normal file
View File

@ -0,0 +1,15 @@
import uuid
import os.path
def unique_files_queue(queue_class):
class UniqueFilesQueue(queue_class):
def __init__(self, path):
path = path + "-" + uuid.uuid4().hex
while os.path.exists(path):
path = path + "-" + uuid.uuid4().hex
super().__init__(path)
return UniqueFilesQueue