-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
All currently defined event callbacks for plugins are synchronous. This means, for example, that one cannot wrap operations in a transaction if the database connection is in turn async.
The fix is to add await at all of the callback invocations in processGraphQLRequest in apollo-service-core/requestPipeline.ts, which is already an async function. await has no effect if called on non-async functions, so this should be completely backwards compatible.
If there is interest in adopting this change, I'll be happy to create a mergeable repo.
In abstract, the transaction could be started in a context factory. The problem is that there's no clean way to close the transaction connection on completion in that approach.
Metadata
Metadata
Assignees
Labels
No labels