Skip to content

Commit

Permalink
Fixed async logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nataniel4 committed Apr 15, 2020
1 parent aa0b471 commit ecaff40
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- Logs for api request not awaited causing some logs not to be successfully sent

## [4.2.3] - 2020-04-03
### Changed
- Dependencies updated
Expand Down
4 changes: 2 additions & 2 deletions lib/dispatcher.js
Expand Up @@ -95,7 +95,7 @@ class Dispatcher {
if(this.api.shouldLogResponseBody)
log.response.body = omitRecursive(response.body, this.api.excludeFieldsLogResponseBody);

Log.add(this.api.session.clientCode, {
return Log.add(this.api.session.clientCode, {
entity: 'api',
entityId,
type: 'api-request',
Expand Down Expand Up @@ -127,7 +127,7 @@ class Dispatcher {

this._executionFinished = process.hrtime(this._executionStarted);

this._saveLog();
await this._saveLog();

return this.response();
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/dispatcher-test.js
Expand Up @@ -178,7 +178,7 @@ describe('Dispatcher', function() {
mock('logs-disabled/get', LogsDisabled);
mock('logs-minimal/list', LogsMinimal);
mock('logs-minimal/get', LogsMinimal);
sandbox.stub(Log, 'add');
sandbox.stub(Log, 'add').resolves();
});

afterEach(() => {
Expand Down

0 comments on commit ecaff40

Please sign in to comment.