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

validate middleware #156

Merged
merged 3 commits into from
Apr 16, 2024
Merged

validate middleware #156

merged 3 commits into from
Apr 16, 2024

Conversation

ermalkaleci
Copy link
Collaborator

@ermalkaleci ermalkaleci commented Apr 10, 2024

closes #75

@ermalkaleci ermalkaleci requested a review from xlc April 10, 2024 13:14
README.md Outdated Show resolved Hide resolved

pub fn validate(&self, client: Arc<Client>, request: CallRequest, response: CallResult) {
tokio::spawn(async move {
let healthy_endpoints = client.endpoints().iter().filter(|x| x.health().score() > 0);
Copy link
Member

Choose a reason for hiding this comment

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

should we have a helper method healthy_endpoints?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah makes sense

pub fn validate(&self, client: Arc<Client>, request: CallRequest, response: CallResult) {
tokio::spawn(async move {
let healthy_endpoints = client.endpoints().iter().filter(|x| x.health().score() > 0);
futures::future::join_all(healthy_endpoints.map(|endpoint| async {
Copy link
Member

Choose a reason for hiding this comment

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

do we need to filter out the current endpoint?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

response may come from cache, so why not hit them all

@xlc
Copy link
Member

xlc commented Apr 15, 2024

maybe have an example config file

@ermalkaleci
Copy link
Collaborator Author

I think it's easy to copy/paste config from README and make use of validator

@xlc xlc merged commit 50b826d into master Apr 16, 2024
1 check passed
@xlc xlc deleted the validate-middleware branch April 16, 2024 01:45
kostekIV added a commit to Cardinal-Cryptography/subway that referenced this pull request Apr 29, 2024
* subsquid indexer & processor fix (AcalaNetwork#150)

* update deps (AcalaNetwork#155)

* bypass cache for unfinalized blocks (AcalaNetwork#154)

* endpoint health (AcalaNetwork#152)

* Await healthy endpoint (AcalaNetwork#158)

* use only tracing (AcalaNetwork#157)

* Filter call errors (AcalaNetwork#159)

* validate middleware (AcalaNetwork#156)

* validate middleware

* validate extension for config

* rename

* Improve env handling via preprocessing templated config files (AcalaNetwork#162)

* Feat(config): support ${var:-word} and ${var:+word} syntax (AcalaNetwork#164)

* fix cli default value (AcalaNetwork#169)

* improve reconnect wait time (AcalaNetwork#168)
---------

Co-authored-by: mrq1911 <[email protected]>
Co-authored-by: Ermal Kaleci <[email protected]>
Co-authored-by: Jiyuan Zheng <[email protected]>
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.

validate middleware
2 participants