:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
perf(personhog): set mark_active in ingestion consumer lifecycle claims (#100637)
Nick Best71853b96d8c5
diff --git a/nodejs/src/common/persons/repositories/postgres-person-repository.test.ts b/nodejs/src/common/persons/repositories/postgres-person-repository.test.tsindex a16d85dd2763..6ac5332ce190 100644--- a/nodejs/src/common/persons/repositories/postgres-person-repository.test.ts+++ b/nodejs/src/common/persons/repositories/postgres-person-repository.test.ts@@ -614,6 +614,14 @@ describe('PostgresPersonRepository', () => {])await expect(countLifecycleRows(opId)).resolves.toEqual({ ops: 1, persons: 1 })+ const markRow = await postgres.query(+ PostgresUse.PERSONS_WRITE,+ 'SELECT mark_active FROM lifecycle_op_person WHERE op_id = $1',+ [opId],+ 'checkMarkActive'+ )+ expect(markRow.rows[0].mark_active).toBe(true)+await repository.releaseLifecycleMarks(opId, team.id)await expect(countLifecycleRows(opId)).resolves.toEqual({ ops: 0, persons: 0 })})diff --git a/nodejs/src/common/persons/repositories/postgres-person-repository.ts b/nodejs/src/common/persons/repositories/postgres-person-repository.tsindex 6ca26408148f..1d3249e89541 100644--- a/nodejs/src/common/persons/repositories/postgres-person-repository.ts+++ b/nodejs/src/common/persons/repositories/postgres-person-repository.ts@@ -1471,8 +1471,8 @@ export class PostgresPersonRepository)await this.postgres.query(tx ?? PostgresUse.PERSONS_WRITE,- `INSERT INTO lifecycle_op_person (op_id, team_id, person_id, person_uuid, role, ordinal, status)- SELECT $1, $2, u.person_id, u.person_uuid, u.role, u.ordinal, 'marked'+ `INSERT INTO lifecycle_op_person (op_id, team_id, person_id, person_uuid, role, ordinal, status, mark_active)+ SELECT $1, $2, u.person_id, u.person_uuid, u.role, u.ordinal, 'marked', trueFROM unnest($3::bigint[], $4::uuid[], $5::text[], $6::int[]) AS u(person_id, person_uuid, role, ordinal)`,[opId,@@ -1489,7 +1489,9 @@ export class PostgresPersonRepository// violation; a duplicate op_id means a concurrent delivery of the same event.if (error.code === '23505' &&- ['lifecycle_op_person_mark', 'lifecycle_op_pkey'].includes(error.constraint)+ ['lifecycle_op_person_mark', 'lifecycle_op_person_mark_active', 'lifecycle_op_pkey'].includes(+ error.constraint+ )) {throw new PersonClaimedByLifecycleOpError('Person is claimed by a concurrent lifecycle operation',