fix(server): wrap read-modify-write apis with distributed lock (#5979)

This commit is contained in:
DarkSky
2024-03-15 13:31:11 +08:00
committed by GitHub
parent fd4e4123f5
commit 34f892b05b
20 changed files with 412 additions and 79 deletions
@@ -11,6 +11,12 @@ import { GraphQLError } from 'graphql';
import { Config } from '../config';
import { GQLLoggerPlugin } from './logger-plugin';
export type GraphqlContext = {
req: Request;
res: Response;
isAdminQuery: boolean;
};
@Global()
@Module({
imports: [
@@ -30,7 +36,13 @@ import { GQLLoggerPlugin } from './logger-plugin';
: '../../../schema.gql'
),
sortSchema: true,
context: ({ req, res }: { req: Request; res: Response }) => ({
context: ({
req,
res,
}: {
req: Request;
res: Response;
}): GraphqlContext => ({
req,
res,
isAdminQuery: false,