feat: implement asynchronous endpoint synchronization to marketplaces…#34
Merged
shubham3121 merged 2 commits intomainfrom Jan 28, 2026
Merged
feat: implement asynchronous endpoint synchronization to marketplaces…#34shubham3121 merged 2 commits intomainfrom
shubham3121 merged 2 commits intomainfrom
Conversation
… during app startup - Add _sync_endpoints_safe function to handle endpoint synchronization during startup without blocking. - Introduce sync_endpoints method in EndpointHandler to group and sync published endpoints to their respective marketplaces. - Create _build_publish_payload method to streamline payload construction for endpoint publishing. - Enhance EndpointRepository with get_published_endpoints method to retrieve published endpoints for a tenant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces functionality to synchronize published endpoints with external marketplaces, ensuring that all published endpoints are kept up-to-date across connected platforms. It adds a method to bulk sync endpoints at startup and provides supporting repository and API client enhancements to enable this feature.
Key changes include:
Endpoint Synchronization Logic:
sync_endpoints_to_marketplacesmethod toEndpointHandler, which groups published endpoints by marketplace and calls a new sync API for each, handling errors gracefully and logging results._sync_endpoints_safeinmain.pythat triggers endpoint synchronization at server startup in a fire-and-forget manner, ensuring the server remains available even if the sync fails or times out.main.pyto invoke the endpoint sync helper after tenant setup during startup.Repository and API Enhancements:
get_published_endpointstoEndpointRepository, which retrieves all endpoints published to at least one marketplace, with related models, datasets, and policies eagerly loaded.sync_endpointsmethod inSyftHubClientto call the new bulk sync API on SyftHub, overwriting existing endpoints with the provided list.Code Refactoring:
_build_publish_payloadmethod to avoid duplication and improve maintainability. [1] [2]Anyinhandlers.pyto support new type annotations.or_fromsqlmodelinrepository.pyto support the new query logic for fetching published endpoints.