mirror of
https://github.com/bcicen/ctop.git
synced 2025-12-06 15:16:41 +08:00
docker.go: watchEvents() optimize actionName extraction
Split(e.Action, ":") creates and array but we can avoid this.
This commit is contained in:
@@ -68,7 +68,13 @@ func (cm *Docker) watchEvents() {
|
|||||||
continue
|
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 {
|
switch actionName {
|
||||||
case "start", "die", "pause", "unpause", "health_status":
|
case "start", "die", "pause", "unpause", "health_status":
|
||||||
|
|||||||
Reference in New Issue
Block a user