Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/snaps-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Increase size of request queue when Snap is booting ([#3340](https://github.com/MetaMask/snaps/pull/3340))

## [11.2.1]

### Fixed
Expand Down
74 changes: 16 additions & 58 deletions packages/snaps-controllers/src/snaps/SnapController.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4814,63 +4814,21 @@ describe('SnapController', () => {
);

// Fill up the request queue
const finishPromise = Promise.all([
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 1,
},
}),
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 2,
},
}),
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 3,
},
}),
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 4,
},
}),
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 5,
},
}),
]);
const finishPromise = Promise.all(
new Array(100).fill(1).map(async (_, id) =>
snapController.handleRequest({
snapId,
origin: MOCK_ORIGIN,
handler: HandlerType.OnRpcRequest,
request: {
jsonrpc: '2.0',
method: 'bar',
params: {},
id,
},
}),
),
);

await expect(
snapController.handleRequest({
Expand All @@ -4881,7 +4839,7 @@ describe('SnapController', () => {
jsonrpc: '2.0',
method: 'bar',
params: {},
id: 6,
id: 100,
},
}),
).rejects.toThrow(
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/src/snaps/SnapController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3504,7 +3504,7 @@ export class SnapController extends BaseController<
return existingHandler;
}

const requestQueue = new RequestQueue(5);
const requestQueue = new RequestQueue(100);
// We need to set up this promise map to map snapIds to their respective startPromises,
// because otherwise we would lose context on the correct startPromise.
const startPromises = new Map<string, Promise<void>>();
Expand Down
Loading