Replies: 1 comment
-
If you want to free up resources, you probably want to execute something after the end of the execution. import { isAsyncIterable, Plugin } from '@envelop/types'
function myCustomPlugin() {
async function cleanup() {
// Free up whatever ressources you need here
}
return {
onExeucte: () => ({
onExecuteDone: result => isAsyncIterable(result) ? { onEnd: cleanup } : cleanup()
})
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How to properly handle the user going away in a
@live
,@stream
or@defer
query (or a subscription)?As far as I can tell there are no hooks to listen to subscriptions or streams closing or stopping.
This makes it hard to properly free up resources (like database connections) when the user goes away.
Beta Was this translation helpful? Give feedback.
All reactions