mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-15 10:13:15 -05:00
bugfix
This commit is contained in:
parent
f88cf69173
commit
316ee72177
@ -5,9 +5,9 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import uuid
|
import uuid
|
||||||
from time import sleep
|
|
||||||
|
|
||||||
import tqdm
|
import tqdm
|
||||||
|
from django import db
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
@ -108,12 +108,21 @@ class Command(Renderable, BaseCommand):
|
|||||||
)
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
logging.getLogger().handlers[0].level = logging.ERROR
|
# Note to future self: this prevents django from reusing database
|
||||||
with multiprocessing.Pool(processes=settings.TASK_WORKERS) as pool:
|
# conncetions between processes, which is bad and does not work
|
||||||
list(tqdm.tqdm(
|
# with postgres.
|
||||||
pool.imap_unordered(
|
db.connections.close_all()
|
||||||
handle_document,
|
|
||||||
document_ids
|
try:
|
||||||
),
|
|
||||||
total=len(document_ids)
|
logging.getLogger().handlers[0].level = logging.ERROR
|
||||||
))
|
with multiprocessing.Pool(processes=settings.TASK_WORKERS) as pool:
|
||||||
|
list(tqdm.tqdm(
|
||||||
|
pool.imap_unordered(
|
||||||
|
handle_document,
|
||||||
|
document_ids
|
||||||
|
),
|
||||||
|
total=len(document_ids)
|
||||||
|
))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("Aborting...")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user