Commit 95b064f
committed
Fixed a bug where a double "/" would be added to the load balancers' path.
The previous version would concatenate `areaEtcdKey(area) + "/" + registryLoadBalancerDirectory`. This would result in a path like: "registry/area-name//__lb" instead of the correct one "registry/area-name/__lb", since areaEtcdKey returns a "/"-terminated value". The result was that the `servers` map would always be empty, even when a load balancer was available.
The fix uses path.Join(), instead of just removing the `+ "/" +`. This is because this function is more robust to errors. In fact, path.Joins returns a correct path even when the arguments are something like "a/" and "/b" (which after the fix is no longer the case, anyway). The return in this example would still be "a/b" and not "a//b", like it would happen with this bug. This should solve the bug and be more bug-resistant also for the future.1 parent 9020f78 commit 95b064f
1 file changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | 5 | | |
9 | 6 | | |
10 | 7 | | |
| |||
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
194 | 195 | | |
195 | 196 | | |
196 | 197 | | |
197 | | - | |
| 198 | + | |
| 199 | + | |
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| |||
0 commit comments