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

feat: refresh packages #819

Merged
merged 5 commits into from
Apr 16, 2022
Merged

feat: refresh packages #819

merged 5 commits into from
Apr 16, 2022

Conversation

bodinsamuel
Copy link
Contributor

@bodinsamuel bodinsamuel commented Dec 12, 2021

Introduce the long-awaited live package refresh that will avoid the need for full bootstrap (most of the time).

The strategy is to store the rev (the internal version of the package) in the record.
The expiresAt facets is queried, sorted and picked by oldest.
We query some records (batch of 20 every 2 minutes, to avoid filling the queue) from the oldest facet value and update them like regular job.

To completely enable this feature we need the rev so for the moment it's not possible and will require one more bootstrap.
I don't know yet if it's enough to process everything in a timely fashion.

@bodinsamuel bodinsamuel self-assigned this Dec 12, 2021
@bodinsamuel bodinsamuel marked this pull request as ready for review December 13, 2021 13:22
Copy link
Collaborator

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good idea!

src/watch.ts Outdated Show resolved Hide resolved
src/watch.ts Outdated
}
pushed.push(pkg.objectID);

// If an update come at the same time, this could override the update with old rev.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean while this function is called, or right after this function is called? Could we use a semaphore, and delay adding items to changes consumer until this process is finished, to make sure it's first? Or maybe read the changes that happen between start of this process and end of this process, and skip adding if it's already refreshed for another reason?

@bodinsamuel
Copy link
Contributor Author

I'll merge, I need those update to speedup watch.ts

@bodinsamuel bodinsamuel merged commit 8379ee1 into master Apr 16, 2022
algolia-crawler-bot pushed a commit that referenced this pull request Apr 16, 2022
# [1.5.0](v1.4.32...v1.5.0) (2022-04-16)

### Features

* refresh packages ([#819](#819)) ([8379ee1](8379ee1))
@Haroenv Haroenv deleted the feat/refresh-pacakges branch April 19, 2022 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants