forked from mirrors/bookwyrm
Merge pull request #1384 from bookwyrm-social/generate-image-transaction
Generate image task failing when transaction hasn't completed
This commit is contained in:
commit
d9090e723d
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@ import re
|
||||||
from django.contrib.postgres.search import SearchVectorField
|
from django.contrib.postgres.search import SearchVectorField
|
||||||
from django.contrib.postgres.indexes import GinIndex
|
from django.contrib.postgres.indexes import GinIndex
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.db import transaction
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from model_utils import FieldTracker
|
from model_utils import FieldTracker
|
||||||
from model_utils.managers import InheritanceManager
|
from model_utils.managers import InheritanceManager
|
||||||
|
@ -361,4 +362,6 @@ def preview_image(instance, *args, **kwargs):
|
||||||
changed_fields = instance.field_tracker.changed()
|
changed_fields = instance.field_tracker.changed()
|
||||||
|
|
||||||
if len(changed_fields) > 0:
|
if len(changed_fields) > 0:
|
||||||
generate_edition_preview_image_task.delay(instance.id)
|
transaction.on_commit(
|
||||||
|
lambda: generate_edition_preview_image_task.delay(instance.id)
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue