Skip to content

Commit

Permalink
fix: native_world_state_instance.ts (#9136)
Browse files Browse the repository at this point in the history
This was failing yarn-formatting. Also make the threading magic number a
constant + more polite (no more than #cpus)
  • Loading branch information
ludamad authored Oct 9, 2024
1 parent a5b677c commit 4a204c1
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const NATIVE_LIBRARY_NAME = 'world_state_napi';
const NATIVE_CLASS_NAME = 'WorldState';

const NATIVE_MODULE = bindings(NATIVE_LIBRARY_NAME);
const MAX_WORLD_STATE_THREADS = 16;

export interface NativeWorldStateInstance {
call<T extends WorldStateMessageType>(messageType: T, body: WorldStateRequest[T]): Promise<WorldStateResponse[T]>;
Expand Down Expand Up @@ -97,7 +98,7 @@ export class NativeWorldState implements NativeWorldStateInstance {
},
GeneratorIndex.BLOCK_HASH,
10 * 1024 * 1024, // 10 GB per tree (in KB)
16,
Math.min(cpus().length, MAX_WORLD_STATE_THREADS),
);
this.queue.start();
}
Expand Down

0 comments on commit 4a204c1

Please sign in to comment.