Commit a428800
committed
service/progress: ServiceProgress: avoid fuzzy matching service ID in loop
Tasks with a service filter will result in the daemon performing a lookup
of the full service ID, then updating the provided filter with the actual
ID: https://github.com/moby/moby/blob/96ded2a1badcc5cb99d6d2ab7904d6f9e527cc4b/daemon/cluster/tasks.go#L15-L30
The `getService()` helper has a fast-path for situations where the given
filter is a full ID, before falling back to fuzzy-logic to search filters
by service name or prefix, which would return an error if the result is
ambiguous;
https://github.com/moby/moby/blob/96ded2a1badcc5cb99d6d2ab7904d6f9e527cc4b/daemon/cluster/helpers.go#L62-L81
The loop executed here calls `client.ServiceInspectWithRaw()` to get info
of the service, and that method is ultimately calling the exact same
`getService()` helper on the daemon side, which means that we don't need
to repeat the work; we can use the `Service.ID` resolved from that call,
and use it to apply as filter for listing the tasks.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>1 parent e88b193 commit a428800
1 file changed
Lines changed: 8 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | 82 | | |
91 | 83 | | |
92 | 84 | | |
| |||
151 | 143 | | |
152 | 144 | | |
153 | 145 | | |
154 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
155 | 150 | | |
156 | 151 | | |
157 | 152 | | |
| |||
218 | 213 | | |
219 | 214 | | |
220 | 215 | | |
221 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
| |||
0 commit comments