Skip to content

Conversation

@FilippoMuschera
Copy link

File: /internal/registration/registry.go

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.

…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.
@grussorusso grussorusso merged commit 254141c into serverledge-faas:main Nov 18, 2025
1 check passed
@FilippoMuschera FilippoMuschera deleted the fix-path-registry-bug branch November 30, 2025 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants