@@ -2,6 +2,7 @@ import PQueue from 'p-queue'
22import { AppComponents , IEntityPersisterComponent } from '../../types'
33import { Sync } from '../../types'
44import { Entity } from '@dcl/schemas'
5+ import { ProfileUpdateNotification } from '@dcl/protocol/out-js/decentraland/kernel/comms/v3/archipelago.gen'
56
67const DB_PERSISTENCE_CONCURRENCY = 30
78
@@ -20,8 +21,9 @@ export function createEntityPersisterComponent({
2021 logs,
2122 db,
2223 profilesCache,
23- entityDeploymentTracker
24- } : Pick < AppComponents , 'logs' | 'db' | 'profilesCache' | 'entityDeploymentTracker' > ) : IEntityPersisterComponent {
24+ entityDeploymentTracker,
25+ nats
26+ } : Pick < AppComponents , 'logs' | 'db' | 'profilesCache' | 'entityDeploymentTracker' | 'nats' > ) : IEntityPersisterComponent {
2527 const logger = logs . getLogger ( 'entity-persistent' )
2628
2729 let bootstrapComplete = false
@@ -43,6 +45,23 @@ export function createEntityPersisterComponent({
4345 // mark as processed in bloom filter (permanent tracking)
4446 entityDeploymentTracker . markAsProcessed ( entity . id )
4547
48+ // publish profile update notification to NATS
49+ try {
50+ nats . publish (
51+ 'service.profile_update' ,
52+ ProfileUpdateNotification . encode ( {
53+ address : entity . pointers [ 0 ] ,
54+ profileJson : JSON . stringify ( entity ) ,
55+ timestamp : entity . timestamp
56+ } ) . finish ( )
57+ )
58+ } catch ( err : any ) {
59+ logger . warn ( 'Failed to publish profile update notification' , {
60+ address : entity . pointers [ 0 ] ,
61+ error : err . message
62+ } )
63+ }
64+
4665 const dbEntity : Sync . ProfileDbEntity = {
4766 ...entity ,
4867 pointer : entity . pointers [ 0 ] ,
0 commit comments