Make PostHog async (#3786)

This commit is contained in:
Stanislav Novosad
2025-10-21 21:14:02 -06:00
committed by GitHub
parent 1b5fad9743
commit 54918a1b92
7 changed files with 31 additions and 25 deletions

View File

@@ -148,7 +148,9 @@ class WorkflowRunContext:
workflow_run_context.parameters[context_parameter.key] = context_parameter
# Compute once and cache whether secrets should be included in templates
workflow_run_context.include_secrets_in_templates = workflow_run_context._should_include_secrets_in_templates()
workflow_run_context.include_secrets_in_templates = (
await workflow_run_context._should_include_secrets_in_templates()
)
return workflow_run_context
@@ -203,12 +205,12 @@ class WorkflowRunContext:
label = ""
return self.blocks_metadata.get(label, BlockMetadata())
def _should_include_secrets_in_templates(self) -> bool:
async def _should_include_secrets_in_templates(self) -> bool:
"""
Check if secrets should be included in template formatting based on experimentation provider.
This check is done once per workflow run context to avoid repeated calls.
"""
return app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
return await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
"CODE_BLOCK_ENABLED",
self.workflow_run_id,
properties={"organization_id": self.organization_id},

View File

@@ -351,7 +351,7 @@ class Block(BaseModel, abc.ABC):
else:
try:
screenshot = await browser_state.take_fullpage_screenshot(
use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
use_playwright_fullpage=await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
"ENABLE_PLAYWRIGHT_FULLPAGE",
workflow_run_id,
properties={"organization_id": str(organization_id)},
@@ -659,7 +659,7 @@ class BaseTaskBlock(Block):
try:
# add screenshot artifact for the first task
screenshot = await browser_state.take_fullpage_screenshot(
use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
use_playwright_fullpage=await app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
"ENABLE_PLAYWRIGHT_FULLPAGE",
workflow_run_id,
properties={"organization_id": str(organization_id)},