private async dispatchNotificationMessages()

in src/bll/notifications/NewNotificationWatcher.ts [111:141]


    private async dispatchNotificationMessages(parsedMessage: TcNotificationMessage[]): Promise<void> {
        const obsoleteNotificationIds: Set<number> = this.obsoleteNotificationIds;
        let majorCount: number = 0;

        parsedMessage.forEach((message: TcNotificationMessage) => {
            if (message.myIsImportant && !obsoleteNotificationIds.has(message.myModificationCounter)) {
                majorCount++;
            }
        });

        let minorProcessed: number = 0;
        let notProcessed: number = 0;
        parsedMessage.forEach(async (message: TcNotificationMessage) => {
            if (obsoleteNotificationIds.has(message.myModificationCounter)) {
                //
            } else if (message.myIsImportant) {
                await this.processNewMessage(message);
            } else if (majorCount + minorProcessed < this.MAX_MESSAGE_COUNT_TO_SHOW_SIMULTANEOUSLY) {
                minorProcessed++;
                await this.processNewMessage(message);
            } else {
                notProcessed++;
                await this.processNewMessage(message, true);
            }
        });

        if (majorCount + minorProcessed > 0) {
            Logger.logInfo(`${majorCount + minorProcessed + notProcessed} more notifications were ` +
                `received from TeamCity / ${majorCount + minorProcessed} shown`);
        }
    }