Skip to content

Commit

Permalink
delete event fo moudule events would be ignored (#139)
Browse files Browse the repository at this point in the history
* bugfix delete event fo moudule events would be ignored

* bugfix delete event fo moudule events would be ignored

Co-authored-by: Donghong Huang <[email protected]>
  • Loading branch information
EastMacro2020 and Donghong Huang authored Jan 26, 2021
1 parent 4c659b3 commit 1c871db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions event/event_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type Event struct {
EventType string
Key string
Value interface{}
HasUpdated bool
}

// Listener All Listener should implement this Interface
Expand Down
5 changes: 5 additions & 0 deletions source/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ func (m *Manager) updateEvent(e *event.Event) error {
if e == nil || e.EventSource == "" || e.Key == "" {
return errors.New("nil or invalid event supplied")
}
if e.HasUpdated {
openlog.Info(fmt.Sprintf("config update event %+v has been updated", *e))
return nil
}
openlog.Info("config update event received")
switch e.EventType {
case event.Create, event.Update:
Expand Down Expand Up @@ -444,6 +448,7 @@ func (m *Manager) updateEvent(e *event.Event) error {

}

e.HasUpdated = true
return nil
}

Expand Down

0 comments on commit 1c871db

Please sign in to comment.