mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
docker.go: watchEvents() optimize actionName extraction
Split(e.Action, ":") creates and array but we can avoid this.
This commit is contained in:
parent
5aacdc3772
commit
957cabba2d
@ -68,7 +68,13 @@ func (cm *Docker) watchEvents() {
|
||||
continue
|
||||
}
|
||||
|
||||
actionName := strings.Split(e.Action, ":")[0]
|
||||
actionName := e.Action
|
||||
// Action may have additional param: "exec_create: redis-cli ping" or "health_status: healthy"
|
||||
// We need to strip to have only action name
|
||||
sepIdx := strings.Index(actionName, ": ")
|
||||
if sepIdx != -1 {
|
||||
actionName = actionName[:sepIdx]
|
||||
}
|
||||
|
||||
switch actionName {
|
||||
case "start", "die", "pause", "unpause", "health_status":
|
||||
|
Loading…
Reference in New Issue
Block a user