Skip to content

Commit

Permalink
reverting change to make compute server associations ephemeral
Browse files Browse the repository at this point in the history
- there are good reasons to want it to be ephemeral
- however, there are some subtle issues with user browser's having state
  they try to save after the project restarts, which leads to the new
  compute-servers.syncdb table closing.  This is a general tricky
  problem that needs to be robustly reproduced and solved before
  enabling ephemeral .compute-server.syncdb
  • Loading branch information
williamstein committed Dec 26, 2024
1 parent 33fc023 commit 2c7edc4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/packages/sync/editor/generic/sync-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1867,6 +1867,11 @@ export class SyncDoc extends EventEmitter {
continue;
}
const account_id = this.users[u[1]];
if (!account_id) {
// this happens for ephemeral table when project restarts and browser
// has data it is trying to send.
continue;
}
const locs = this.cursors_table.get(k);
if (locs == null && !this.cursor_map.has(account_id)) {
// gone, and already gone.
Expand Down Expand Up @@ -2548,7 +2553,7 @@ export class SyncDoc extends EventEmitter {
// TODO: handle doctype change here (?)
this.last_snapshot = x.last_snapshot;
this.snapshot_interval = x.snapshot_interval;
this.users = x.users;
this.users = x.users ?? [];
// @ts-ignore
this.project_id = x.project_id;
// @ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion src/packages/util/compute/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const COMPUTER_SERVER_DB_NAME = ".compute-server.syncdb";
export const SYNCDB_PARAMS = {
path: COMPUTER_SERVER_DB_NAME,
primary_keys: ["path"],
ephemeral: true,
ephemeral: false,
cursors: true,
};

Expand Down

0 comments on commit 2c7edc4

Please sign in to comment.