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

AlertQuartz.Consumer#consumer 方法条件判断会出现问题 #267

Closed
zhiyuan192shine opened this issue Nov 21, 2019 · 2 comments
Closed

Comments

@zhiyuan192shine
Copy link

if (lag > alarmConsumer.getLag() && alarmConsumer.getAlarmTimes() <= alarmConsumer.getAlarmMaxTimes()) {
    // alarm consumer
    alarmConsumer.setAlarmTimes(alarmConsumer.getAlarmTimes() + 1);
    alarmConsumer.setIsNormal("N");
    alertService.modifyConsumerStatusAlertById(alarmConsumer);
    try {
        sendAlarmConsumerError(alarmConfing, alarmConsumer, lag);
    } catch (Exception e) {
        LOG.error("Send alarm consumer exception has error, msg is " + e.getCause().getMessage());
    }
} else {
    if (alarmConsumer.getIsNormal().equals("N")) {
        alarmConsumer.setIsNormal("Y");
        // clear error alarm and reset
        alarmConsumer.setAlarmTimes(0);
        // notify the cancel of the alarm
        alertService.modifyConsumerStatusAlertById(alarmConsumer);
        try {
            sendAlarmConsumerNormal(alarmConfing, alarmConsumer, lag);
        } catch (Exception e) {
            LOG.error("Send alarm consumer normal has error, msg is " + e.getCause().getMessage());
        }
    }
}

alarmConsumer.getAlarmTimes() <= alarmConsumer.getAlarmMaxTimes() 不需要 = , 只需要 < 就行,否会导致 else 代码块执行,出现 lag > lag_threshold 情况仍会被正常告警

@smartloli
Copy link
Owner

OK, Fixed this bug in the next release.

@smartloli
Copy link
Owner

fixed by v1.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants