Skip to content

Commit

Permalink
fix: syntax error in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Mar 14, 2024
1 parent 40580a8 commit 77f5517
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ export class WorkspaceResolver {
try {
// lock to prevent concurrent invite
const lockFlag = `invite:${workspaceId}`;
await using _lock = await this.mutex.lock(lockFlag);
await using lock = await this.mutex.lock(lockFlag);
if (!lock) {
return new TooManyRequestsException('Server is busy');
}

// member limit check
const [memberCount, quota] = await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/server/src/fundamentals/mutex/mutex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LockGuard<M extends MutexService = MutexService>
}
}

export const MUTEX_RETRY = 3;
export const MUTEX_RETRY = 5;
export const MUTEX_WAIT = 100;

@Injectable({ scope: Scope.REQUEST })
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/server/tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../../../tsconfig.json",
"compilerOptions": {
"composite": true,
"target": "ESNext",
"target": "ES2022",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"rootDir": ".",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/server/tests/workspace-invite.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,6 @@ test('should limit member count correctly', async t => {
);

const ws = await getWorkspace(app, u1.token.token, workspace.id);
t.is(ws.members.length, 3, 'failed to check member list');
t.assert(ws.members.length <= 3, 'failed to check member list');
}
});

0 comments on commit 77f5517

Please sign in to comment.