mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 02:08:59 +08:00
chore: handle error before using task (#6055)
This commit is contained in:
parent
419d2da363
commit
b49ed913c7
@ -476,15 +476,15 @@ func (m *Manager) addTask(rule *PostableRule, taskName string) error {
|
|||||||
UseLogsNewSchema: m.opts.UseLogsNewSchema,
|
UseLogsNewSchema: m.opts.UseLogsNewSchema,
|
||||||
})
|
})
|
||||||
|
|
||||||
for _, r := range newTask.Rules() {
|
|
||||||
m.rules[r.ID()] = r
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zap.L().Error("creating rule task failed", zap.String("name", taskName), zap.Error(err))
|
zap.L().Error("creating rule task failed", zap.String("name", taskName), zap.Error(err))
|
||||||
return errors.New("error loading rules, previous rule set restored")
|
return errors.New("error loading rules, previous rule set restored")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, r := range newTask.Rules() {
|
||||||
|
m.rules[r.ID()] = r
|
||||||
|
}
|
||||||
|
|
||||||
// If there is an another task with the same identifier, raise an error
|
// If there is an another task with the same identifier, raise an error
|
||||||
_, ok := m.tasks[taskName]
|
_, ok := m.tasks[taskName]
|
||||||
if ok {
|
if ok {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user