mirror of https://github.com/scrapy/scrapy.git
function to get unique file queues for any type of base queue
This commit is contained in:
parent
886513c375
commit
a25cf5c82f
|
|
@ -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
|
||||
Loading…
Reference in New Issue