Skip to content

cli/command: deprecate EventHandler and InitEventHandler - #4936

Merged
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:deprecate_eventhandler
Mar 11, 2024
Merged

cli/command: deprecate EventHandler and InitEventHandler#4936
thaJeztah merged 1 commit into
docker:masterfrom
thaJeztah:deprecate_eventhandler

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

This code was only used as part of container.RunStats, so moving the code there instead as a non-exported type. The actual use also did not have to handle concurrency, so the mutex is removed in the new location.

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztahthaJeztah added status/2-code-review kind/refactor PR's that refactor, or clean-up code labels Mar 11, 2024
@thaJeztahthaJeztah added this to the 26.0.0 milestone Mar 11, 2024
@thaJeztahthaJeztah self-assigned this Mar 11, 2024
Comment threadcli/command/container/stats.go Outdated
handlers map[events.Action]func(events.Message)
}

func (w *eventHandler) handle(action events.Action, h func(events.Message)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very minor nits here:

  • w as the eventHandler name? Could we use eh like we do above?
  • For the naming i'd suggest something along the lines of setHandler/setActionHandler etc since we don't actually do any handling in here. WDYT?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, yes, can rename the receiver. no idea where the original w came from (I just copied).

Perhaps setHandler (or addHandler maybe?) would work here. I can change that. That said, I think we need to cleanup more in this area. It's all feels a bit over-complicated (also looking at the monitorContainerEvents closure - perhaps things can be rolled up there). I didn't spend too much time yet looking at what's best there.

This code was only used as part of container.RunStats, so moving the code
there instead as a non-exported type. The actual use also did not have to
handle concurrency, so the mutex is removed in the new location.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztahforce-pushed the deprecate_eventhandler branch from bf362a6 to 46afd26CompareMarch 11, 2024 12:25
@codecov-commenter

codecov-commenter commented Mar 11, 2024

Copy link
Copy Markdown

Codecov Report

Merging #4936 (46afd26) into master (d06f137) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

Additional details and impacted files
@@ Coverage Diff @@## master #4936 +/- ##
==========================================
- Coverage 61.47% 61.43% -0.04% 
==========================================
Files 289 289 Lines 20226 20237 +11 ==========================================
Hits 12433 12433 - Misses 6892 6903 +11 
Partials 901 901 

@thaJeztah
thaJeztah merged commit a2f3f40 into docker:masterMar 11, 2024
@thaJeztah
thaJeztah deleted the deprecate_eventhandler branch March 11, 2024 13:21
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactorPR's that refactor, or clean-up codestatus/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@thaJeztah@codecov-commenter@vvoland@krissetto