如何防止客户因事件信号延迟而犯错?

i want to let component A know component B ,when B die ,A remove all B info,and when B born ,A regist B info. A watch the notice which write the info of B's die or born ,but due to long time need to confirm die info, the die info on notice will delay if B die and immediately reborn ,the reborn info come before the die info,B record the info using a variable(that maybe unsuitable),i do not know how to deal with this situation,anyone can help? here is the code

this is the code watch the etcd event

    for wresp := range rch {
    for _, ev := range wresp.Events {
        switch ev.Type {
            case clientv3.EventTypePut:
                fmt.Printf("[%s] %q : %q
", ev.Type, ev.Kv.Key, ev.Kv.Value)
                info := GetServiceInfo(ev)
                m.AddNode(string(ev.Kv.Key),info)
                m.Needflush = "add"
            case clientv3.EventTypeDelete:
                fmt.Printf("[%s] %q : %q
", ev.Type, ev.Kv.Key, ev.Kv.Value)
                delete(m.Nodes, string(ev.Kv.Key))
                m.Needflush = "del"
        }
    }
}

this is the code which i depend on the watched event do some operates

for {
    if m.Needflush == "del" {
        purge_ds(grafana_addr, "test_datasource")
        m.Needflush = "no"
    } else if m.Needflush == "add" {
        prometheus_addr = read_prometheusip(m.Client, "monitor/prometheus_ip")
        add_ds(grafana_addr, "test_datasource", prometheus_addr)
        m.Needflush = "no"
    }
    time.Sleep(time.Second * 5)
}