Skip to content

Commit

Permalink
fix(logger): fix logger storage issue for key already exists (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib authored Jul 10, 2024
1 parent 82f2215 commit 0810574
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 20 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "0.3.7",
"version": "0.3.8",
"changelog": true,
"changelogPreset": {
"name": "conventionalcommits",
Expand Down
4 changes: 2 additions & 2 deletions packages/builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-builder",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -44,7 +44,7 @@
"webpack": "^5.75.0"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"yargs": "17.6.2"
}
}
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-cli",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -31,7 +31,7 @@
"@types/node-fetch": "2.6.3"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"commander": "10.0.1",
"fs-extra": "11.1.1",
"node-fetch": "^2.6.9",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-core",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -25,8 +25,8 @@
"@ringcentral/mfe-shared": "^0.1.0"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-transport": "^0.3.7"
"@ringcentral/mfe-shared": "^0.3.8",
"@ringcentral/mfe-transport": "^0.3.8"
},
"bugs": {
"url": "https://github.com/ringcentral/ringcentral-mfe/issues"
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-logger",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -25,7 +25,7 @@
"@ringcentral/mfe-shared": "^0.1.0"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"@roarr/browser-log-writer": "1.3.0",
"dexie": "3.2.4",
"file-saver": "2.0.5",
Expand Down
12 changes: 11 additions & 1 deletion packages/logger/src/transports/storage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
/* eslint-disable consistent-return */
import { getLogLevelName, Message } from 'roarr';
import { global } from '@ringcentral/mfe-shared';
Expand Down Expand Up @@ -219,8 +220,17 @@ export class StorageTransport implements ITransport {

protected _savingLogs = new Set<Logs>();

protected _saveLogs(data: Logs) {
protected async _checkTimeKey(time: number): Promise<number> {
const count = await this._table?.where('time').equals(time).count();
if (count) {
return this._checkTimeKey(time + 1);
}
return time;
}

protected async _saveLogs(data: Logs) {
this._savingLogs.add(data);
data.time = await this._checkTimeKey(data.time);
const savingLogsPromise = this._table?.add(data).then(() => {
this._savingLogs.delete(data);
if (this.savingLogsPromise === savingLogsPromise) {
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-react",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -39,7 +39,7 @@
"react": "^17.0.2"
},
"dependencies": {
"@ringcentral/mfe-core": "^0.3.7"
"@ringcentral/mfe-core": "^0.3.8"
},
"devDependencies": {
"@testing-library/react": "^12.1.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/sentry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-sentry",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -39,7 +39,7 @@
"@ringcentral/mfe-shared": "^0.1.0"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"@sentry/browser": "^7.99.0",
"@sentry/tracing": "^7.99.0"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/service-worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-service-worker",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "index.js",
"module": "index.mjs",
Expand Down Expand Up @@ -46,7 +46,7 @@
"webpack": "^5.75.0"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"crypto": "^1.0.1",
"ts-md5": "1.3.1",
"workbox-window": "6.5.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-shared",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
4 changes: 2 additions & 2 deletions packages/transport/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ringcentral/mfe-transport",
"version": "0.3.7",
"version": "0.3.8",
"description": "A micro frontends framework for building Web applications",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down Expand Up @@ -39,7 +39,7 @@
"data-transport": "^4.3.5"
},
"dependencies": {
"@ringcentral/mfe-shared": "^0.3.7",
"@ringcentral/mfe-shared": "^0.3.8",
"data-transport": "^4.3.5"
}
}

0 comments on commit 0810574

Please sign in to comment.