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

fix: archive - simplify and enhance async retention policy application #2278

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

Ivansete-status
Copy link
Collaborator

Description

This PR fixes an issue that made the whole wakunode2 to get stuck when applying the retention policy at the beginning of the execution. That happened because we used waitFor which blocks everything until the task end.

With that PR, we perform a better retention policy application approach, i.e. a fully asynchronous task that can be canceled anytime. We also simplify the approach by avoiding using a "timer".

Changes

  • Use of async retention policy task

How to test

Test case 1

  1. Start a node with Store configured, with _Postgres for example, and then it many messages, with a wide retention policy (capacity:10000000)
  2. Restart the node but in this case with shorter retention policy, capacity:10.
  3. The node applies the retention policy, without blocking any other task.

Test case 2

  1. Start the node, changing the code a little so that the retention policy is applied every 3 seconds.
  2. Keep sending/publishing messages to the node.
  3. The amount of messages stored in the Postgres database fluctuates around the retention policy value, considering that "capacity" is being used as a retention policy.

Issue

closes #2238

* Avoid using timer and just use an infinite async loop that can be
cancelled at any time.
@Ivansete-status Ivansete-status marked this pull request as ready for review December 8, 2023 10:22
@Ivansete-status Ivansete-status self-assigned this Dec 8, 2023
Copy link

github-actions bot commented Dec 8, 2023

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2278

Built from cde6c6b

@Ivansete-status Ivansete-status merged commit 77c5ba7 into master Dec 11, 2023
9 of 10 checks passed
@Ivansete-status Ivansete-status deleted the better-async-retention-policy-application branch December 11, 2023 07:50
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.

chore: avoid blocking the whole waku node when retention policy is being applied
3 participants