Skip to content

Commit f448419

Browse files
committed
revert some lint fixes for universal notifications
1 parent c321bd2 commit f448419

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

connect/connectNotificationServer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const getNotificationsForMentionedUser = (logger, eventConfig, content) => {
9292
_.forEach(notifications, (notification) => {
9393
const mentionedUser = _.find(users, { handle: notification.userHandle });
9494
notification.userId = mentionedUser ? mentionedUser.userId.toString() : null;
95-
if (!notification.userId && logger) { // such notifications would be discarded later after aggregation
95+
if (!notification.userId && logger) {// such notifications would be discarded later after aggregation
9696
logger.info(`Unable to find user with handle ${notification.userHandle}`);
9797
}
9898
});
@@ -102,11 +102,12 @@ const getNotificationsForMentionedUser = (logger, eventConfig, content) => {
102102
logger.error(error);
103103
logger.info('Unable to send notification to mentioned user');
104104
}
105-
// resolves with empty notification which essentially means we are unable to send notification to mentioned user
105+
//resolves with empty notification which essentially means we are unable to send notification to mentioned user
106106
return Promise.resolve([]);
107107
});
108+
} else {
109+
return Promise.resolve([]);
108110
}
109-
return Promise.resolve([]);
110111
};
111112

112113
/**

src/app.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const healthcheck = require('topcoder-healthcheck-dropin');
2121
// helps in health checking in case of unhandled rejection of promises
2222
const unhandledRejections = [];
2323
process.on('unhandledRejection', (reason, promise) => {
24-
logger.debug('Unhandled Rejection at:', promise, 'reason:', reason);
24+
console.log('Unhandled Rejection at:', promise, 'reason:', reason);
2525
// aborts the process to let the HA of the container to restart the task
2626
// process.abort();
2727
unhandledRejections.push(promise);
@@ -31,7 +31,7 @@ process.on('unhandledRejection', (reason, promise) => {
3131
// from the unhandledRejections array. We just remove the first element from the array as we only care
3232
// about the count every time an unhandled rejection promise is handled
3333
process.on('rejectionHandled', (promise) => {
34-
logger.debug('Handled Rejection at:', promise);
34+
console.log('Handled Rejection at:', promise);
3535
unhandledRejections.shift();
3636
});
3737

@@ -93,10 +93,10 @@ function startKafkaConsumer(handlers, notificationServiceHandlers) {
9393
});
9494
});
9595

96-
let latestSubscriptions = null;
96+
var latestSubscriptions = null;
9797

9898
const check = function () {
99-
logger.debug('Checking health');
99+
logger.debug("Checking health");
100100
if (unhandledRejections && unhandledRejections.length > 0) {
101101
logger.error('Found unhandled promises. Application is potentially in stalled state.');
102102
return false;
@@ -106,12 +106,12 @@ function startKafkaConsumer(handlers, notificationServiceHandlers) {
106106
return false;
107107
}
108108
let connected = true;
109-
const currentSubscriptions = consumer.subscriptions;
110-
for (const sIdx of currentSubscriptions) {
109+
let currentSubscriptions = consumer.subscriptions;
110+
for(var sIdx in currentSubscriptions) {
111111
// current subscription
112-
const sub = currentSubscriptions[sIdx];
112+
let sub = currentSubscriptions[sIdx];
113113
// previous subscription
114-
const prevSub = latestSubscriptions ? latestSubscriptions[sIdx] : null;
114+
let prevSub = latestSubscriptions ? latestSubscriptions[sIdx] : null;
115115
// levarage the `paused` field (https://github.com/oleksiyk/kafka/blob/master/lib/base_consumer.js#L66) to
116116
// determine if there was a possibility of an unhandled exception. If we find paused status for the same
117117
// topic in two consecutive health checks, we assume it was stuck because of unhandled error
@@ -123,11 +123,11 @@ function startKafkaConsumer(handlers, notificationServiceHandlers) {
123123
// stores the latest subscription status in global variable
124124
latestSubscriptions = consumer.subscriptions;
125125
consumer.client.initialBrokers.forEach(conn => {
126-
logger.debug(`url ${conn.server()} - connected=${conn.connected}`);
127-
connected = conn.connected & connected;
126+
logger.debug(`url ${conn.server()} - connected=${conn.connected}`)
127+
connected = conn.connected & connected
128128
});
129-
return connected;
130-
};
129+
return connected
130+
}
131131

132132
consumer
133133
.init()

0 commit comments

Comments
 (0)