Skip to content

[pull] main from tldraw:main#249

Merged
pull[bot] merged 2 commits intocode:mainfrom
tldraw:main
Oct 31, 2025
Merged

[pull] main from tldraw:main#249
pull[bot] merged 2 commits intocode:mainfrom
tldraw:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Oct 31, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

ds300 added 2 commits October 31, 2025 10:12
testing this some more in production I noticed that it was not
effectively clearing the cache data for users who aren't signed in and
active. That's because if they aren't connected there's no cache so the
reboot doesn't get called. this fixes that.

### Change type

- [x] `other`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Deletes the user's R2 snapshot before rebooting in
`admin_migrateToGroups` to properly reset cache for offline users, and
adds more detailed debug logs around migration and reboots.
> 
> - **Sync Worker**
> - **Migration flow**
(`apps/dotcom/sync-worker/src/TLUserDurableObject.ts`):
> - Delete user snapshot
`USER_DO_SNAPSHOTS.delete(getUserDoSnapshotKey(...))` before cache
reboot in `admin_migrateToGroups` to ensure fresh state.
>     - Add debug logs: start, result, and completion of migration.
> - **Reboot logging**
(`apps/dotcom/sync-worker/src/UserDataSyncer.ts`):
> - Expand `reboot` debug message to include `hard` and `delay` flags.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
65e16b9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
after trying this in staging yesterday we noticed a spike in sql
connections.

I had cursor hoist the connection to the parent process and clean up the
migration script a little.

### Change type

- [x] `other`

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Switches batch user migration to a single-connection, sequential flow
with per-user sleep, new stats/progress, and matching UI/API changes.
> 
> - **Backend (sync-worker)**:
> - Replace batch migration with sequential per-user loop using one PG
pool; add `sleepMs` param only.
> - Introduce `startUserMigration`, `getNextUnmigratedUser`,
`getNumUnmigratedUsers`, `getTotalUsers` helpers.
> - Use SQL function `migrate_user_to_groups(...)` and force user DO
reboot; send richer stats (`totalUsers`, `usersToMigrate`,
`successCount`, `failureCount`, `progress`).
> - Update SSE endpoint `/app/admin/migrate_users_batch` to emit new
progress schema; `/app/admin/unmigrated_users_count` now returns DB
count directly.
> - **Frontend (admin.tsx)**:
> - Simplify Batch Migration UI: remove `batchSize` and `maxUsers`; add
`sleepMs` only.
> - Update confirmation text, help copy, and stats display to show
`usersToMigrate` and percentage `progress`.
> - Stream handling now directly sets `stats` from SSE `details`;
updated controls to start/stop accordingly.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d86ab5f. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@pull pull Bot locked and limited conversation to collaborators Oct 31, 2025
@pull pull Bot added the ⤵️ pull label Oct 31, 2025
@pull pull Bot merged commit fb5d6dd into code:main Oct 31, 2025
0 of 5 checks passed
@pull pull Bot had a problem deploying to deploy-staging October 31, 2025 15:13 Failure
@pull pull Bot had a problem deploying to deploy-production October 31, 2025 15:13 Failure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant