Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove identity notifications processor #6303

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 11 additions & 48 deletions packages/identity-service/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const ethTxRelay = require('./relay/ethTxRelay')
const { runMigrations } = require('./migrationManager')
const audiusLibsWrapper = require('./audiusLibsInstance')

const NotificationProcessor = require('./notifications/index.js')
const { generateWalletLockKey } = require('./relay/txRelay.js')
const { generateETHWalletLockKey } = require('./relay/ethTxRelay.js')

Expand Down Expand Up @@ -45,17 +44,6 @@ class App {
this.optimizelyPromise = null
this.optimizelyClientInstance = this.configureOptimizely()

// Async job configuration
this.notificationProcessor = new NotificationProcessor({
errorHandler: (error) => {
try {
return Sentry.captureException(error)
} catch (sentryError) {
logger.error(`Received error from Sentry ${sentryError}`)
}
}
})

// Note: The order of the following functions is IMPORTANT, as it sets the functions
// that process a request in the order applied
this.expressSettings()
Expand All @@ -67,7 +55,6 @@ class App {

async init() {
let server
await this.getAudiusAnnouncements()
logger.info('identity init')

/**
Expand All @@ -76,7 +63,7 @@ class App {
* the user will sometimes want to launch a cluster of Node.js processes to handle the load.
* The cluster module allows easy creation of child processes that all share server ports."
*
* We have the master node in the cluster run migrations and start notifications processor
* We have the master node in the cluster run migrations and start workers.
* The workers start express server processes
*/
if (cluster.isMaster) {
Expand Down Expand Up @@ -110,7 +97,6 @@ class App {
})

const audiusInstance = await this.configureAudiusInstance()
cluster.fork({ WORKER_TYPE: 'notifications' })

await this.configureRewardsAttester(audiusInstance)
await this.configureDiscoveryNodeRegistration(audiusInstance)
Expand Down Expand Up @@ -147,27 +133,18 @@ class App {
// if it's not the master worker in the cluster
const audiusInstance = await this.configureAudiusInstance()
await this.configureReporter()
await new Promise((resolve) => {
server = this.express.listen(this.port, resolve)
})
server.setTimeout(config.get('setTimeout'))
server.timeout = config.get('timeout')
server.keepAliveTimeout = config.get('keepAliveTimeout')
server.headersTimeout = config.get('headersTimeout')

if (process.env.WORKER_TYPE === 'notifications') {
await this.notificationProcessor.init(
audiusInstance,
this.express,
this.redisClient
)
} else {
await new Promise((resolve) => {
server = this.express.listen(this.port, resolve)
})
server.setTimeout(config.get('setTimeout'))
server.timeout = config.get('timeout')
server.keepAliveTimeout = config.get('keepAliveTimeout')
server.headersTimeout = config.get('headersTimeout')

this.express.set('redis', this.redisClient)
this.express.set('redis', this.redisClient)

logger.info(`Listening on port ${this.port}...`)
return { app: this.express, server }
}
logger.info(`Listening on port ${this.port}...`)
return { app: this.express, server }
}
}

Expand Down Expand Up @@ -420,20 +397,6 @@ class App {
}
this.express.use(errorHandler)
}

async getAudiusAnnouncements() {
try {
const { announcements, announcementMap } = await fetchAnnouncements()
this.express.set('announcements', announcements)
this.express.set('announcementMap', announcementMap)
} catch (err) {
const audiusNotificationUrl = config.get('audiusNotificationUrl')
logger.error(
`Error, unable to get audius announcements from ${audiusNotificationUrl} \n [Err]:`,
err
)
}
}
}

module.exports = App