Skip to content

Commit 78abab5

Browse files
authored
fix: stabilize membersGlobalActivityCount mv refresh (CM-1302) (#4309)
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent 2576aca commit 78abab5

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

backend/src/database/migrations/R__memberEnrichmentMaterializedViews.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ where msa."segmentId" IN (
1010
where "grandparentId" is not null
1111
and "parentId" is not null
1212
)
13-
group by msa."memberId"
14-
order by sum(msa."activityCount") desc;
13+
group by msa."memberId";
1514
create unique index ix_member_global_activity_count_member_id on "membersGlobalActivityCount" ("memberId");
1615
create index ix_member_global_activity_count on "membersGlobalActivityCount" (total_count);
1716

services/apps/members_enrichment_worker/src/activities/enrichment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ export async function getObsoleteSourcesOfMember(
765765
}
766766

767767
export async function refreshMemberEnrichmentMaterializedView(mvName: string): Promise<void> {
768-
await refreshMaterializedView(svc.postgres.writer.connection(), mvName)
768+
await refreshMaterializedView(svc.postgres.writer.connection(), mvName, true)
769769
}
770770

771771
interface IWorkExperienceChanges {

services/apps/members_enrichment_worker/src/workflows/refreshMemberEnrichmentMaterializedViews.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { MemberEnrichmentMaterializedView } from '@crowd/types'
55
import * as activities from '../activities'
66

77
const { refreshMemberEnrichmentMaterializedView } = proxyActivities<typeof activities>({
8-
startToCloseTimeout: '10 minutes',
8+
startToCloseTimeout: '45 minutes',
9+
retry: {
10+
initialInterval: '15 seconds',
11+
backoffCoefficient: 2,
12+
maximumAttempts: 3,
13+
},
914
})
1015

1116
export async function refreshMemberEnrichmentMaterializedViews(): Promise<void> {

0 commit comments

Comments
 (0)