@arque/core
Advanced tools
Comparing version 0.10.2 to 0.10.3
@@ -96,4 +96,2 @@ "use strict"; | ||
async _reload() { | ||
let hrtime; | ||
hrtime = process.hrtime(); | ||
const snapshot = await this.store.findLatestSnapshot({ | ||
@@ -105,3 +103,2 @@ aggregate: { | ||
}); | ||
this.logger.debug(`findLatestSnapshot: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
if (snapshot) { | ||
@@ -111,3 +108,2 @@ this._state = this.opts.deserializeState(snapshot.state); | ||
} | ||
hrtime = process.hrtime(); | ||
const events = await this.store.listEvents({ | ||
@@ -119,3 +115,2 @@ aggregate: { | ||
}); | ||
this.logger.debug(`listEvents: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
await this.digest(events); | ||
@@ -133,6 +128,3 @@ } | ||
async dispatch(params, ctx) { | ||
let hrtime; | ||
hrtime = process.hrtime(); | ||
await this.store.saveEvents(params); | ||
this.logger.debug(`saveEvents: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
const events = params.events.map((item, index) => (Object.assign(Object.assign({}, item), { timestamp: params.timestamp, aggregate: { | ||
@@ -142,3 +134,2 @@ id: this.id, | ||
}, meta: Object.assign(Object.assign({}, item.meta), { __ctx: ctx }) }))); | ||
hrtime = process.hrtime(); | ||
await this.stream.sendEvents([ | ||
@@ -150,3 +141,2 @@ { | ||
]); | ||
this.logger.debug(`sendEvents: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
await this.digest(events); | ||
@@ -166,7 +156,4 @@ if (this.shoudTakeSnapshot()) { | ||
var _a; | ||
let hrtime; | ||
const handler = this.commandHandler(command.type); | ||
hrtime = process.hrtime(); | ||
const release = await this.mutex.acquire(); | ||
this.logger.debug(`mutex: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
let first = true; | ||
@@ -190,3 +177,2 @@ if ((opts === null || opts === void 0 ? void 0 : opts.noReload) !== true) { | ||
}, command, ...command.args); | ||
hrtime = process.hrtime(); | ||
await this.dispatch({ | ||
@@ -208,10 +194,9 @@ aggregate: { | ||
}, ctx); | ||
this.logger.debug(`dispatch: elapsed=${Math.floor(process.hrtime(hrtime)[1] / 1e6)}ms`); | ||
}, { | ||
delayFirstAttempt: false, | ||
jitter: 'full', | ||
maxDelay: 800, | ||
numOfAttempts: (_a = opts === null || opts === void 0 ? void 0 : opts.maxRetries) !== null && _a !== void 0 ? _a : 5, | ||
startingDelay: 100, | ||
timeMultiple: 2, | ||
maxDelay: 400, | ||
numOfAttempts: (_a = opts === null || opts === void 0 ? void 0 : opts.maxRetries) !== null && _a !== void 0 ? _a : 10, | ||
startingDelay: 10, | ||
timeMultiple: 1.5, | ||
retry: (err) => { | ||
@@ -218,0 +203,0 @@ if (err instanceof store_adapter_1.AggregateVersionConflictError) { |
{ | ||
"name": "@arque/core", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "`arque` core library", | ||
@@ -5,0 +5,0 @@ "author": "ScaleForge", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48474
806