Skip to content

Commit ff9fe05

Browse files
authored
fix: blocking when creating opengraph images (#33197)
1 parent 7e3b26a commit ff9fe05

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

posthog/api/exports.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ def validate(self, data: dict) -> dict:
6161
return data
6262

6363
def synthetic_create(self, reason: str, *args: Any, **kwargs: Any) -> ExportedAsset:
64-
return self._create_asset(self.validated_data, user=None, reason=reason)
64+
# force_async here to avoid blocking patches to the /sharing endpoint
65+
return self._create_asset(self.validated_data, user=None, reason=reason, force_async=True)
6566

6667
def create(self, validated_data: dict, *args: Any, **kwargs: Any) -> ExportedAsset:
6768
request = self.context["request"]
@@ -72,6 +73,7 @@ def _create_asset(
7273
validated_data: dict,
7374
user: User | None,
7475
reason: str | None,
76+
force_async: bool = False,
7577
) -> ExportedAsset:
7678
if user is not None:
7779
validated_data["created_by"] = user
@@ -103,7 +105,7 @@ def _create_asset(
103105
only_evaluate_locally=False,
104106
send_feature_flag_events=False,
105107
)
106-
if blocking_exports:
108+
if blocking_exports and not force_async:
107109
exporter.export_asset(instance.id)
108110
else:
109111
exporter.export_asset.delay(instance.id)

0 commit comments

Comments
 (0)