Wiredcraft / jekyllpro-cms

A lightweight CMS for Jekyll websites.
http://jekyllpro.com/#cms
MIT License
7 stars 2 forks source link

Slow search experience #44

Closed JuhaS closed 6 years ago

JuhaS commented 7 years ago
JuhaS commented 7 years ago

@woodpig07 can you maybe give your ideas on what could be good approach.

Few notes:

As a short term solution that targets the usecase where file-changes happen through jekyllpro-cms:

woodpig07 commented 7 years ago

I agree on the use of socket.io to notify frontend about the modification to repo, but I believe it would act like a publish/subscribe service for the index document in mongodb, not directly triggered by user commits. Currently we only update the index in a passive way by refreshing the app page. I had built a webhook to update index incrementally based on commit data, I'd like very much to take advantage of that for a real-time (or near real-time) experiences.

Proposed work flow:

  1. User 1 browses on cms.jekyllpro.com/repo, the App presents the files extracted from the index saved in database, and websocket client start to listen on change events.
  2. Somewhere User 2 make a change to the repo, the webhook catches it and starts to update index quickly as it only has to process the files related to this commit.
  3. After it successfully write to database, socket.Io publishes it to client, then frontend requests to load latest index data, all the users on cms.jekyllpro.com/repo will see the updated file list/content.
JuhaS commented 7 years ago

I had built a webhook to update index incrementally based on commit data, I'd like very much to take advantage of that for a real-time (or near real-time) experiences.

Is this already in the repo? Can @haishanh leverage that already?

About using GH webhook I think we should primarily design without requiring this since this will require manual setup from the user side. Instead I would recommend this:

@woodpig07 do you think this would be ok?

JuhaS commented 7 years ago

Talked with @haishanh

Technical approach (first steps):

Next:

haishanh commented 7 years ago

Sorry for delaying...

This issue is becoming very critical now, as the sbux website repo have over 360 entries. And it's extremely slow at displaying all content after new entry is added.

In this PR https://github.com/Wiredcraft/jekyllpro-cms/pull/61

I've added a new API endpoint /api/repository/updated-collections, which will only return modified/removed entries if there are changes between 2 commits. The frontend will call this API every 8sec.

The Socket.IO feature is not implemented yet.

As this issue is becoming a blocker for the marketing team. I'd like to land the PR ASAP.

@JuhaS @woodpig07 Can you help review the PR?

woodpig07 commented 7 years ago

@haishanh please go ahead merge your PR, I left a few suggestions there, hope that's helpful.

woodpig07 commented 6 years ago

not relevant anymore