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

delete event fo moudule events would be ignored #139

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该值似乎永远不会为true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在manager.go文件的updateEvent方法的最后,会把它置为true

}

// 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