(changesets: ILocalChangeset[])
| 484 | // Force data to be sent to the server to avoid data jamming and not sending due to process problems. |
| 485 | // As long as a persistent connection exists, data will be sent. |
| 486 | private forceSend(changesets: ILocalChangeset[]) { |
| 487 | const actionLength = changesets.reduce((pre, cur) => { |
| 488 | return ( |
| 489 | pre + |
| 490 | cur.operations.reduce((p, c) => { |
| 491 | return p + c.actions.length; |
| 492 | }, 0) |
| 493 | ); |
| 494 | }, 0); |
| 495 | |
| 496 | // Note: In the case of pasting large data, the server may return slowly, and the data will not be re-sent at this time. |
| 497 | if (actionLength > MAX_RETRY_LENGTH) { |
| 498 | console.error('Paste data in large batches, the retry operation will not be performed'); |
| 499 | return; |
| 500 | } |
| 501 | |
| 502 | Player.doTrigger(Events.app_error_logger, { |
| 503 | error: new Error('force send userChanges'), |
| 504 | }); |
| 505 | this.event.setRoomLastSendTime(); |
| 506 | |
| 507 | void this.sendUserChanges(changesets); |
| 508 | } |
| 509 | |
| 510 | /** |
| 511 | * Send user-generated changeset |
no test coverage detected