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

Gateway - don't log updates on startup #3421

Merged
merged 5 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/apollo-gateway/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
1. Previously, the `experimental_didUpdateComposition` hook wouldn't be reliably called unless the `experimental_pollInterval` was set. If it _was_ called, it was sporadic and didn't necessarily mark the timing of an actual composition update. After this change, the hook is called on a successful composition update.
2. The `experimental_pollInterval` configuration option now affects both the GCS polling interval when gateway is configured for managed federation, as well as the polling interval of services. The former being newly introduced behavior.
* Gateway cached DataSource bug [#3412](https://github.com/apollographql/apollo-server/pull/3412) introduces a fix for managed federation users where `DataSource`s wouldn't update correctly if a service's url changed. This bug was introduced with heavier DataSource caching in [#3388](https://github.com/apollographql/apollo-server/pull/3388). By inspecting the `url` as well, `DataSource`s will now update correctly when a composition update occurs.

* Gateway - don't log updates on startup [#3421](https://github.com/apollographql/apollo-server/pull/3421) Fine tune gateway startup logging - on load, instead of logging an "update", log the service id, variant, and mode in which gateway is running.
# v.0.10.7

> [See complete versioning details.](https://github.com/apollographql/apollo-server/commit/fc7462ec5f8604bd6cba99aa9a377a9b8e045566)
Expand Down
13 changes: 10 additions & 3 deletions packages/apollo-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ export class ApolloGateway implements GraphQLService {

public async load(options?: { engine?: GraphQLServiceEngineConfig }) {
await this.updateComposition(options);
const { graphId, graphVariant } = (options && options.engine) || {};
const mode = isManagedConfig(this.config) ? 'managed' : 'unmanaged';

this.logger.info(
`Gateway successfully loaded schema.\n\t* Mode: ${mode}${graphId ? `\n\t* Service: ${graphId}@${graphVariant || 'current'}`: ''}`,
);
if (this.experimental_pollInterval) {
setInterval(
() => this.updateComposition(options),
Expand Down Expand Up @@ -292,15 +298,16 @@ export class ApolloGateway implements GraphQLService {
) {
this.logger.debug('No change in service definitions since last check');
return;
} else {
this.serviceDefinitions = result.serviceDefinitions;
}

if (previousSchema) {
trevor-scheer marked this conversation as resolved.
Show resolved Hide resolved
this.logger.info('Gateway config has changed, updating schema');
}

this.compositionMetadata = result.compositionMetadata;
this.serviceDefinitions = result.serviceDefinitions;

if (this.queryPlanStore) this.queryPlanStore.flush();
this.logger.info('Gateway config has changed, updating schema');

this.schema = this.createSchema(result.serviceDefinitions);
try {
Expand Down