Skip to content

Commit 230cf6d

Browse files
author
Vikas Agarwal
committed
Avoiding usage of explicit constructor anti pattern and instead use library method which takes care of most of the things with better fault tolerance and less chances of breaking the promise chain.
1 parent 566fe4f commit 230cf6d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

connect/connectNotificationServer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const getProjectMembersNotifications = (eventConfig, project) => {
149149
return Promise.resolve([]);
150150
}
151151

152-
return new Promise((resolve) => {
152+
return Promise.promisify((callback) => {
153153
let notifications = [];
154154
const projectMembers = _.get(project, 'members', []);
155155

@@ -184,8 +184,8 @@ const getProjectMembersNotifications = (eventConfig, project) => {
184184
// only one per userId
185185
notifications = _.uniqBy(notifications, 'userId');
186186

187-
resolve(notifications);
188-
});
187+
callback(null, notifications);
188+
})();
189189
};
190190

191191
/**

0 commit comments

Comments
 (0)