From 851410006a7f03f8354a1ec57c94c768e7910d47 Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 3 Aug 2021 07:00:31 -0700 Subject: [PATCH] Fixes remote server not getting set Omg this took so long for me to figure out --- bookwyrm/models/user.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index 49458a2e..8c59315b 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -7,7 +7,7 @@ from django.contrib.auth.models import AbstractUser, Group from django.contrib.postgres.fields import CICharField from django.core.validators import MinValueValidator from django.dispatch import receiver -from django.db import models +from django.db import models, transaction from django.utils import timezone from model_utils import FieldTracker import pytz @@ -253,7 +253,7 @@ class User(OrderedCollectionPageMixin, AbstractUser): # this is a new remote user, we need to set their remote server field if not self.local: super().save(*args, **kwargs) - set_remote_server.delay(self.id) + transaction.on_commit(lambda: set_remote_server.delay(self.id)) return # populate fields for local users