private async processNewChangesIfRequired()

in src/bll/notifications/NewNotificationWatcher.ts [80:100]


    private async processNewChangesIfRequired(): Promise<void> {
        const credentials: Credentials = this.myCredentialsStore.getCredentialsSilently();
        if (!credentials) {
            return;
        }
        const buildMessages: string[] = await this.myRemoteBuildServer.getBuildMessages(this.myLastTimestamp);
        if (buildMessages && buildMessages.length > 0) {
            Logger.logInfo("NotificationWatcherImpl#processNewChangesIfRequired: Event counter has changed. Should process new changes.");
            const parsedMessages: TcNotificationMessage[] = [];
            for (const message of buildMessages) {
                const parsedMessage: TcNotificationMessage = await this.myXmlParser.parseNotificationMessage(message);
                parsedMessages.push(parsedMessage);
            }
            parsedMessages.sort((nm1: TcNotificationMessage, nm2: TcNotificationMessage) => {
                const diff: number = nm1.myModificationCounter - nm2.myModificationCounter;
                return diff > 0 ? 1 : (diff < 0 ? -1 : 0);
            });
            this.updateLastTimestamp(parsedMessages);
            await this.dispatchNotificationMessages(parsedMessages);
        }
    }