Removing a registered or subscribed service leaves stale local metadata After a…
- User
Removing a registered or subscribed service leaves stale local metadata
After a successful unregister or unsubscribe operation, the corresponding provider or consumer URL must no longer participate in local metadata, service matching, or revision calculation. Removing one URL must preserve unrelated registrations. If the remote operation fails, local metadata must not be removed as though the operation succeeded.
Interface
Type: Function Name: RemoveService Path: metadata/metadata.go Input: registryId string, url *common.URL Output: (no return value) Description: Removes a provider service URL from the local metadata for the given registry. Use this during unregister flows to keep the in-memory application-level metadata consistent with the actual exported services.
Type: Function Name: RemoveSubscribeURL Path: metadata/metadata.go Input: registryId string, url *common.URL Output: (no return value) Description: Removes a subscribed service URL from the local metadata for the given registry. Use this during unsubscribe flows to ensure stale subscribed URLs are cleaned from the application-level metadata.
- Assistant
Inspecting metadata handling and unregister/unsubscribe flows in the repository.
- Assistant
Implementing metadata removal wrappers and wiring them into unregister/unsubscribe flows, with per-URL unregister to preserve unrelated registrations.
- Assistant
Summary
Stale local metadata after unregister/unsubscribe is fixed by exposing removal at the metadata package level and calling it only after successful remote operations.
metadata/metadata.goRemoveService(registryId, url)– delegates toMetadataInfo.RemoveServicewhen metadata exists for that registry.RemoveSubscribeURL(registryId, url)– same for subscribed URLs.
registry/servicediscovery/service_discovery_registry.goUnSubscribe– afterserviceNameMapping.Removesucceeds, callsmetadata.RemoveSubscribeURL. On mapping failure, local subscribe metadata is left unchanged.UnRegister– unregisters only the instance matchingurl.Address()(not all instances). On successfulUnregister, drops that instance and callsmetadata.RemoveService. On remote failure, metadata is not updated.UnRegisterService– on each successful instance unregister, calls so bulk shutdown clears metadata per successful instance; failed instances stay in both remote tracking and metadata.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.