mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-14 13:47:58 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a594638230 |
@@ -21,6 +21,7 @@ from typing import ClassVar
|
|||||||
from typing import Generic
|
from typing import Generic
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
|
|
||||||
|
import django
|
||||||
from django import db
|
from django import db
|
||||||
from django.core.management import CommandError
|
from django.core.management import CommandError
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
@@ -534,7 +535,10 @@ class PaperlessCommand(RichCommand):
|
|||||||
with self._create_progress(description) as progress:
|
with self._create_progress(description) as progress:
|
||||||
task_id = progress.add_task(description, total=total)
|
task_id = progress.add_task(description, total=total)
|
||||||
|
|
||||||
with ProcessPoolExecutor(max_workers=self.process_count) as executor:
|
with ProcessPoolExecutor(
|
||||||
|
max_workers=self.process_count,
|
||||||
|
initializer=django.setup,
|
||||||
|
) as executor:
|
||||||
# Submit all tasks and map futures back to items
|
# Submit all tasks and map futures back to items
|
||||||
future_to_item = {executor.submit(fn, item): item for item in items}
|
future_to_item = {executor.submit(fn, item): item for item in items}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user