(data: ISocketResponseData, clearAllStorage = true)
| 584 | @errorCapture<RoomService>() |
| 585 | @socketGuard() |
| 586 | async handleRejectCommit(data: ISocketResponseData, clearAllStorage = true) { |
| 587 | // If the message is repeated, no need to refresh |
| 588 | if (data.code === OtErrorCode.MSG_ID_DUPLICATE) { |
| 589 | console.log(data.message); |
| 590 | this.nextSend(); |
| 591 | return; |
| 592 | } |
| 593 | |
| 594 | const bufferStorage = this.collaEngineMap.get(this.roomId)?.bufferStorage; |
| 595 | |
| 596 | Player.doTrigger(Events.app_error_logger, { |
| 597 | error: new Error(`Incorrect op message: ${data.message}`), |
| 598 | metaData: { |
| 599 | roomId: this.roomId, |
| 600 | connected: this.connected, |
| 601 | socketConnected: this.io.socket.connected, |
| 602 | opBuffer: JSON.stringify(bufferStorage?.opBuffer), |
| 603 | localPendingChangeset: JSON.stringify(bufferStorage?.localPendingChangeset), |
| 604 | }, |
| 605 | }); |
| 606 | |
| 607 | if (clearAllStorage) { |
| 608 | // Before clearing the data, make a local backup of the cleared data |
| 609 | await this.backupDB.setItem(String(Date.now()), { |
| 610 | opBufferMap: this.getBufferOperateMap(), |
| 611 | changesetMap: keyBy(this.getLocalPendingChangesets(), 'resourceId'), |
| 612 | }); |
| 613 | this.clearAllStorage(); |
| 614 | } |
| 615 | |
| 616 | console.trace('Wrong op information'); |
| 617 | throw new EnhanceError(data); |
| 618 | } |
| 619 | |
| 620 | private getBufferOperateMap() { |
| 621 | const bufferOperateMap: Record<string, IOperation[]> = {}; |
no test coverage detected