-
Notifications
You must be signed in to change notification settings - Fork 109
enh: store awareness messages separately #3776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4fce40b
bc8c78c
88b6fa7
ffaf7bb
e89201f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| - **💾 Open format:** Files are saved as [Markdown](https://en.wikipedia.org/wiki/Markdown), so you can edit them from any other text app too. | ||
| - **✊ Strong foundation:** We use [🐈 tiptap](https://tiptap.scrumpy.io) which is based on [🦉 ProseMirror](https://prosemirror.net) – huge thanks to them! | ||
| ]]></description> | ||
| <version>3.7.0</version> | ||
| <version>3.7.1</version> | ||
| <licence>agpl</licence> | ||
| <author mail="[email protected]">Julius Härtl</author> | ||
| <namespace>Text</namespace> | ||
|
|
||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace OCA\Text\Migration; | ||
|
|
||
| use Closure; | ||
| use OCP\DB\ISchemaWrapper; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
|
|
||
| /** | ||
| * Auto-generated migration step: Please modify to your needs! | ||
| */ | ||
| class Version030701Date20230207131313 extends SimpleMigrationStep { | ||
|
|
||
| /** | ||
| * @param IOutput $output | ||
| * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
| * @param array $options | ||
| * @return null|ISchemaWrapper | ||
| */ | ||
| public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { | ||
| /** @var ISchemaWrapper $schema */ | ||
| $schema = $schemaClosure(); | ||
|
|
||
| $table = $schema->getTable('text_sessions'); | ||
| if (!$table->hasColumn('last_awareness_message')) { | ||
| $table->addColumn('last_awareness_message', \OCP\DB\Types::TEXT, [ | ||
| 'notnull' => false, | ||
| 'default' => '' | ||
| ]); | ||
| return $schema; | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,19 +88,33 @@ export default function initWebSocketPolyfill(syncService, fileId, initialSessio | |
| } | ||
|
|
||
| #initiateSending() { | ||
| let steps | ||
| let outbox | ||
| syncService.sendSteps(() => { | ||
| steps = this.#queue.map(s => encodeArrayBuffer(s)) | ||
| outbox = this.#queue | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect this is due to us replaying old awareness messages and creating an inconstent state. |
||
| const data = { | ||
| steps: this.#steps, | ||
| awareness: this.#awareness, | ||
| version: this.#version, | ||
| } | ||
| this.#queue = [] | ||
| const version = this.#version | ||
| logger.debug('sending steps ', { version, steps }) | ||
| return { version, steps } | ||
| logger.debug('sending steps ', data) | ||
| return data | ||
| })?.catch(() => { | ||
| // try again | ||
| this.send(...steps) | ||
| // try to send the steps again | ||
| this.#queue = [...outbox, ...this.#queue] | ||
| }) | ||
| } | ||
|
|
||
| get #steps() { | ||
| return this.#queue.map(s => encodeArrayBuffer(s)) | ||
| .filter(s => s < 'AQ') | ||
| } | ||
|
|
||
| get #awareness() { | ||
| return this.#queue.map(s => encodeArrayBuffer(s)) | ||
| .findLast(s => s > 'AQ') || '' | ||
| } | ||
|
|
||
| close() { | ||
| Object.entries(this.#handlers) | ||
| .forEach(([key, value]) => syncService.off(key, value)) | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.