Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excessive API calls in displaying document list using Yorkie REST API #173

Open
hackerwins opened this issue Mar 14, 2024 · 0 comments
Open
Labels
enhancement 🌟 New feature or request

Comments

@hackerwins
Copy link
Member

hackerwins commented Mar 14, 2024

What would you like to be added:

When displaying the document list in CodePair, the Yorkie REST API is being excessively called.

  • Upon entering the Workspace in CodePair, users can view the document list.
  • To display this document list, CodePair Server first queries the DB for paging to retrieve the document list.
  • Additionally, to show the last update time of the documents, the Yorkie REST API is called.
  • The Yorkie REST API only provides an API to retrieve a single document, leading to multiple unnecessary API calls.

So we need to provide a bulk API that accepts multiple document keys and returns information for multiple documents.

Why is this needed:

The document list should be displayed without causing excessive REST API calls.

Additional Information:

const slicedDocumentList = documentList.slice(0, pageSize);
const mergedDocumentList = await Promise.all(
slicedDocumentList.map(async (doc) => {
// Get updatedAt field from Yorkie server
return this.findDocumentFromYorkie(doc.yorkieDocumentId).then((yorkieDoc) => {
return {
...doc,
updatedAt: yorkieDoc.document?.updatedAt
? moment(yorkieDoc.document?.updatedAt).toDate()
: doc.updatedAt,
};
});
})
);

https://github.com/yorkie-https://github.com/yorkie-team/yorkie/blob/eadb194a7aae85bd41d60b9619c8689d41599bee/api/yorkie/v1/admin.proto#L38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement 🌟 New feature or request
Projects
Status: No status
Development

No branches or pull requests

1 participant