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
Now wire these into the unregister/unsubscribe flows in the service discovery registry, only after the remote operation succeeds:
- Assistant
Now build and run the relevant tests:
- Assistant
Now add a test at the
infolevel for the match-key guard (two URLs sharing one match key) and value-equality removal: - Assistant
Now run the broader test suites to make sure nothing regressed:
- Assistant
All done. Summary of the fix:
Changes
metadata/metadata.go— added the two requested package-level functions:RemoveService(registryId string, url *common.URL)— removes a provider URL from the registry's localMetadataInfo; no-op if the registry has no metadata.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.