这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tirumaraiselvan
Copy link
Contributor

@tirumaraiselvan tirumaraiselvan commented Aug 20, 2019

Description

Adds an optional timeout_seconds argument to add_remote_schema API

Affected components

  • Server
  • Console
  • Docs

Related Issues

#2501

Solution and Design

Steps to test and verify

Limitations, known bugs & workarounds

@netlify
Copy link

netlify bot commented Aug 20, 2019

Deploy preview for hasura-docs ready!

Built with commit d39a04c

https://deploy-preview-2753--hasura-docs.netlify.com

@hasura-bot
Copy link
Contributor

Review app for commit 3816f3c deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-3816f3cd

@hasura-bot
Copy link
Contributor

Review app for commit 9910b20 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-9910b203

@tirumaraiselvan tirumaraiselvan changed the title add timeout to remote schema calls (close #2501) add timeout to remote schema calls and pass client headers to remote server (close #2501, #2572) Aug 21, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 3e3dde0 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-3e3dde08

@rikinsk-zz
Copy link

@tirumaraiselvan Can you update the API changes in docs

rikinsk-zz
rikinsk-zz previously approved these changes Aug 21, 2019
@hasura-bot
Copy link
Contributor

Review app for commit b48d3d5 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-b48d3d5a

wreqOptions manager hdrs =
Wreq.defaults
& Wreq.headers .~ contentType : userAgent : hdrs
& Wreq.headers .~ defaultHeaders <> hdrs
Copy link
Contributor

Choose a reason for hiding this comment

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

Don’t we need to avoid adding userAgent here if it’s in hdrs already? I think it’s legal for certain HTTP headers to be specified multiple times, so I imagine wreq will currently just send both. (It’d be nice to be able to have a test case for this, but IIUC it’s not super easy to do with the current test harness?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right! Thanks.

@tirumaraiselvan tirumaraiselvan changed the title add timeout to remote schema calls and pass client headers to remote server (close #2501, #2572) add timeout to remote schema calls (close #2501) Aug 23, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 4258210 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-42582106

[ (CI.mk "Content-Type", "application/json")
, (CI.mk "User-Agent", "hasura-graphql-engine/" <> T.encodeUtf8 currentVersion)
]
addDefaultHeaders hdrs = defaultHeaders <> rmDefaultHeaders hdrs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lexi-lambda This change has led me to believe that we have HTTP clients which are not using the Hasura.HTTP library basically (event trigger module and remote schema module):

The only modules which seem to be using this are:

Telemetry
Auth
Auth/JWT
CheckUpdates

Is it fine for EventTriggers and RemoteSchemas to maintain their own clients because these might be specific to these modules.

Copy link
Contributor

Choose a reason for hiding this comment

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

This function appears to prioritize default headers over the headers that were passed in, but the code in GraphQL.Execute appears to prioritize the headers that were passed in over the default headers. Is the difference intentional?

Also, can this code at least share the defaultHeaders declaration with the one in Hasura.HTTP? Having it duplicated in both places seems worth avoiding if we can help it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was my question. Is it worth sharing these tiny functions, when the bulk of the client is specified per module itself? Shouldn't HTTP.Hasura give out a client with these baked in for standard usage? Those who are not using it may do their own thing including defaultHeaders?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don’t know, as I haven’t looked at the code in detail, but my gut instinct is that

  1. these modules should probably be using Hasura.HTTP,

  2. but if they aren’t, and you don’t want to do the refactoring to make them use it right now, sharing the default headers is an alright first step.

If the first assumption isn’t true, then you could be right, but I’d be surprised if it were. Is there a reason these modules shouldn’t be using the same library?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is any real reason except the library didn't have proper functions to use with Event Triggers. I guess we should make an attempt to consolidate the library then.

Cool, I am just going to share the functions then. Let's do the full consolidation in a separate no-op refactor PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good. 👍

@hasura-bot
Copy link
Contributor

Review app for commit cd5e656 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-cd5e656c

@hasura-bot
Copy link
Contributor

Review app for commit 1bbbc46 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-1bbbc462

lexi-lambda
lexi-lambda previously approved these changes Aug 23, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 1c6285d deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-1c6285d8

rikinsk-zz
rikinsk-zz previously approved these changes Aug 23, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 0c444f6 deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-0c444f6a

@rikinsk-zz rikinsk-zz dismissed stale reviews from marionschleifer, lexi-lambda, and themself via d39a04c August 23, 2019 08:08
@hasura-bot
Copy link
Contributor

Review app for commit d39a04c deployed to Heroku: https://hge-ci-pull-2753.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2753-d39a04ca

@0x777 0x777 merged commit 9878421 into hasura:master Aug 23, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-2753.herokuapp.com is deleted

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
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.

8 participants