I am adding ApolloServerPluginDrainHttpServer to our configuration and would like to know if there is a way to verify that ApolloServerPluginDrainHttpServer is setup correctly and actually is working as expected?
In addition we are running federation, so I am assuming I should use ApolloServerPluginDrainHttpServer on the gateway and all children, is this assumption correct?
Thank you
btw, I had to set ApolloServerPluginDrainHttpServer to Apollo Server Plugin Drain Http Server in the title so it would be accepted by the Discourse (threw error, word too long).
Write a tiny plugin with (say) an async requestDidStart handler that takes like five seconds to resolve. Something like this (just typing it here, not checking that it builds):
new ApolloServer({
plugins: [{
requestDidStart() {
return new Promise(resolve => {
setTimeout(() => {
console.log("made it five seconds");
resolve();
}, 5000);
});
}
}],
// ...
})
Start your server, issue a request to it, quickly send your server a SIGINT (eg, hit Ctrl-C), and hopefully observe that about five seconds later, the log message gets printed, the client gets its response, and the server exits.