🐛(summary) fix feature flag on summary job
Sadly, we used user db id as the posthog distinct id of identified user, and not the sub. Before this commit, we were only passing sub to the summary microservice. Add the owner's id. Please note we introduce a different naming behavir, by prefixing the id with "owner". We didn't for the sub and the email. We cannot align sub and email with this new naming approach, because external contributors have already started building their own microservice.
This commit is contained in:
committed by
aleb_the_flash
parent
9cb9998384
commit
c3eb877377
@@ -131,8 +131,8 @@ class NotificationService:
|
||||
if not owner_access:
|
||||
logger.error("No owner found for recording %s", recording.id)
|
||||
return False
|
||||
|
||||
payload = {
|
||||
"owner_id": str(owner_access.user.id),
|
||||
"filename": recording.key,
|
||||
"email": owner_access.user.email,
|
||||
"sub": owner_access.user.sub,
|
||||
|
||||
@@ -18,6 +18,7 @@ settings = get_settings()
|
||||
class TaskCreation(BaseModel):
|
||||
"""Task data."""
|
||||
|
||||
owner_id: str
|
||||
filename: str
|
||||
email: str
|
||||
sub: str
|
||||
@@ -35,6 +36,7 @@ async def create_task(request: TaskCreation):
|
||||
"""Create a task."""
|
||||
task = process_audio_transcribe_summarize_v2.apply_async(
|
||||
args=[
|
||||
request.owner_id,
|
||||
request.filename,
|
||||
request.email,
|
||||
request.sub,
|
||||
|
||||
@@ -204,6 +204,7 @@ def task_failure_handler(task_id, exception=None, **kwargs):
|
||||
)
|
||||
def process_audio_transcribe_summarize_v2(
|
||||
self,
|
||||
owner_id: str,
|
||||
filename: str,
|
||||
email: str,
|
||||
sub: str,
|
||||
@@ -320,7 +321,7 @@ def process_audio_transcribe_summarize_v2(
|
||||
metadata_manager.capture(task_id, settings.posthog_event_success)
|
||||
|
||||
if (
|
||||
analytics.is_feature_enabled("summary-enabled", distinct_id=sub)
|
||||
analytics.is_feature_enabled("summary-enabled", distinct_id=owner_id)
|
||||
and settings.is_summary_enabled
|
||||
):
|
||||
logger.info("Queuing summary generation task.")
|
||||
|
||||
Reference in New Issue
Block a user