func (this *SafeEvents) Put(event *model.Event) { if event.Status == "OK" { this.Delete(event.Id) return } dto := &EventDto{} dto.Id = event.Id dto.Endpoint = event.Endpoint dto.Metric = event.Metric() dto.Counter = event.Counter() dto.Func = event.Func() dto.LeftValue = utils.ReadableFloat(event.LeftValue) dto.Operator = event.Operator() dto.RightValue = utils.ReadableFloat(event.RightValue()) dto.Note = event.Note() dto.MaxStep = event.MaxStep() dto.CurrentStep = event.CurrentStep dto.Priority = event.Priority() dto.Status = event.Status dto.Timestamp = event.EventTime dto.ExpressionId = event.ExpressionId() dto.StrategyId = event.StrategyId() dto.TemplateId = event.TplId() dto.Link = Link(event) this.Lock() defer this.Unlock() this.M[dto.Id] = dto }