File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change 11import { subHours } from 'date-fns' ;
22import { Cron } from './cron' ;
33import { UserExperience } from '../entity/user/experiences/UserExperience' ;
4- import { In , MoreThan } from 'typeorm' ;
4+ import { In } from 'typeorm' ;
55import { processStream } from '../common/streaming' ;
66import { logger } from '../logger' ;
77import { getSecondsTimestamp , triggerTypedEvent } from '../common' ;
@@ -39,18 +39,12 @@ export const userProfileUpdatedSync: Cron = {
3939 const userExperiences = await queryReadReplica (
4040 con ,
4141 async ( { queryRunner } ) => {
42- const changedUserProfiles : Pick < UserExperience , 'userId' > [ ] =
43- await queryRunner . manager . getRepository ( UserExperience ) . find ( {
44- select : [ 'userId' ] ,
45- where : {
46- updatedAt : MoreThan ( timeThreshold ) ,
47- } ,
48- relations : {
49- skills : true ,
50- company : true ,
51- location : true ,
52- } ,
53- } ) ;
42+ const changedUserProfiles = await queryRunner . manager
43+ . getRepository ( UserExperience )
44+ . createQueryBuilder ( )
45+ . select ( 'DISTINCT "userId"' , 'userId' )
46+ . where ( '"updatedAt" > :timeThreshold' , { timeThreshold } )
47+ . getRawMany < { userId : string } > ( ) ;
5448
5549 // get all experiences for the changed user profiles so we can send full profile updates
5650 const userExperiences = await queryReadReplica (
You can’t perform that action at this time.
0 commit comments