mirror of
https://github.com/wekan/wekan.git
synced 2026-11-07 02:52:33 -05:00
On a grain's first launch after upgrade, sandstorm-src/start.js migrates the old MongoDB data to FerretDB v1 (SQLite) before starting WeKan. While nothing was listening on the grain's app port (during migration and the handoff to WeKan), sandstorm-http-bridge got connection-refused and the browser showed "This page can not be displayed embedded in another page"; the user had to close the grain and open it again. start.js now runs migration-bridge.js as a child process on the app port that answers every URL with a small auto-refreshing "please wait" page (HTTP 503), so the grain stays framed until WeKan is up. It is a separate process on purpose: start.js runs the migration with blocking spawnSync, so it could neither service an in-process server nor release its listening socket before the importer/Meteor bind the port -- killing a child is a definitive socket close. The bridge starts before migration, YIELDS the port around the importer (which serves its own progress dashboard there), resumes for the handoff, and is released just before Meteor binds the port. Every use is best-effort (guarded by existsSync, error handlers, killed on grain exit) so it can never break grain startup. build-deps.sh ships migration-bridge.js next to start.js in the deps payload. Thanks to xet7 !