fix: simplify syncRepos call in push to resolve trpc issue #321
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.
Pull Request
Proposed Changes
Our team has been facing issues with syncing not working on our deployed version of private-mirrors. Everything works locally but when deployed the syncing fails with a TRPCClientError that has no further details. Every other feature of private-mirrors is working from what we can tell and we are unsure if this issue may be affecting other private-mirrors installations. Through investigation, we attempted to get any meaningful error or debug log output but were unable to get anything helpful.
After taking a more in depth look at the implementation, we noticed that the sync functionality was the only trpc call made from the server rather than from a client browser and it seemed that there isn't much benefit to calling the sync function this way. Instead, there is added complexity by going through trpc that could be avoided by calling the function directly. This PR modifies the push handling of private-mirrors to call the syncReposHandler directly instead of going through trpc which resolves the issue that we were encountering and reduces complexity.
While it would be nice to isolate the original issue to prevent any similar future problems, this change effectively resolves the issue and even if the issue is not present in other deployments in our opinion should be merged to reduce the likelihood over other issues arising.
Any feedback would be greatly appreciated, this code is also the only area where the serverTrpc is used so that related code can be removed if desired unless it is intended to be used for another purpose. It's likely that any similar usage of serverTrpc will cause the same issue.
Readiness Checklist
Author/Contributor
npm run lint
and fix any linting issues that have been introducednpm run test
and run tests@jeffrey-luszcz
Reviewer
bug
,documentation
,enhancement
,infrastructure
,maintenance
, orbreaking