Skip to content

Commit

Permalink
feat: Update ajv-threads package to version with worker pool
Browse files Browse the repository at this point in the history
  • Loading branch information
stbrody committed Mar 5, 2024
1 parent f2b50c6 commit c6fe092
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@stablelib/random": "^1.0.1",
"@stablelib/sha256": "^1.0.1",
"@stablelib/uuid": "^1.0.1",
"ajv-threads": "^1.0.3",
"ajv-threads": "^1.0.4",
"await-semaphore": "^0.1.3",
"cartonne": "^3.0.1",
"codeco": "^1.1.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/ceramic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ export class Ceramic implements StreamReaderWriter, StreamStateLoader {

this._ipfs = modules.ipfs

this._schemaValidator = new SchemaValidation()
const numCores = os.cpus().length
// Use number of threads equal to half the available cores for schema validation. Leave the
// other half for signature validation.
this._schemaValidator = new SchemaValidation(Math.floor(numCores / 2))
this._streamHandlers = HandlersMap.makeWithDefaultHandlers(this._logger, this._schemaValidator)

// This initialization block below has to be redone.
Expand Down
2 changes: 1 addition & 1 deletion packages/stream-model-instance-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@ceramicnetwork/stream-handler-common": "^4.1.0",
"@ceramicnetwork/stream-model-instance": "^4.2.0",
"@ceramicnetwork/streamid": "^5.0.0",
"ajv-threads": "^1.0.3",
"ajv-threads": "^1.0.4",
"fast-json-patch": "^3.1.0",
"least-recent": "^1.0.3",
"lodash.clonedeep": "^4.5.0",
Expand Down

0 comments on commit c6fe092

Please sign in to comment.