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

Reduce interval to re-trigger app validation workflow to 100-1000 milliseconds #3884

Merged

Conversation

jost-s
Copy link
Contributor

@jost-s jost-s commented May 17, 2024

Summary

I think the title is a summary of this small PR.

TODO:

  • CHANGELOGs updated with appropriate info

// Trigger app validation workflow again in 10 seconds.
WorkComplete::Incomplete(Some(Duration::from_secs(10)))
// Trigger app validation workflow again in 20-2000 milliseconds.
let interval = max(101 - validations_dependencies.missing_hashes.len(), 1) * 20;
Copy link
Contributor Author

@jost-s jost-s May 17, 2024

Choose a reason for hiding this comment

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

There are lots of formulas for this interval. I don't even have enough data to decide if this adaptation to number of missing hashes makes sense or if a fixed interval of 1 second is equally suitable.

@@ -27,7 +27,7 @@ impl Default for ValidationDependencies {
}

impl ValidationDependencies {
const FETCH_TIMEOUT: Duration = Duration::from_secs(60);
const FETCH_TIMEOUT: Duration = Duration::from_secs(30);
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My reasoning is that if there are a few hashes that cannot be fetched, app validation will retrigger every couple of 100 ms. It would continue for 60 seconds, so I thought 30 seconds is a compromise between a frequent re-trigger and enough time to fetch hashes from a slow node.

Copy link
Member

@maackle maackle May 20, 2024

Choose a reason for hiding this comment

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

This seems inconsistent given that we allow 60 sec for fetching data in other contexts. It seems like if we are willing to reduce the timeout here, we should reduce it everywhere, because similar reasoning applies in other situations, especially because it's been asserted that running validation is not very expensive, so a constant factor of 2 in worst-case time difference should not have that much effect compared to the actual effect of waiting 60 seconds to determine the fetchability of some data. i.e. if it's undesirable to wait 60 seconds here, it seems equally undesirable everywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fine, agreed.

@jost-s jost-s requested a review from maackle May 21, 2024 01:34
@jost-s jost-s enabled auto-merge (squash) May 22, 2024 15:59
@jost-s jost-s merged commit e7a697b into develop May 22, 2024
11 checks passed
@jost-s jost-s deleted the refactor/reduce-interval-before-re-triggering-app-validation branch May 22, 2024 19:17
@abe-njama abe-njama changed the title Reduce interval to re-trigger app validation workflow to 20-2000 ms Reduce interval to re-trigger app validation workflow to 100-1000 milliseconds May 22, 2024
ThetaSinner pushed a commit that referenced this pull request Jun 10, 2024
…00 ms (#3884)

* refactor(app-validation-wf): reduce interval to re-trigger to 20-2000 ms

* refactor: update re-trigger formula & lower fetch timeout

* revert fetch timeout

* fix interval calculation

* Update CHANGELOG.md
ThetaSinner added a commit that referenced this pull request Jun 10, 2024
…to 100-1000 milliseconds (#3999)

* refactor(app-validation-wf): reduce interval to re-trigger to 99-1000 ms (#3884)

* refactor(app-validation-wf): reduce interval to re-trigger to 20-2000 ms

* refactor: update re-trigger formula & lower fetch timeout

* revert fetch timeout

* fix interval calculation

* Update CHANGELOG.md

Co-authored-by: Jost Schulte <jost.schulte@protonmail.com>
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.

None yet

3 participants