Page MenuHomePhabricator

[server] Add delay before setuping database and running migrations
ClosedPublic

Authored by jacek on Jul 12 2022, 5:26 AM.
Tags
None
Referenced Files
F3396455: D4506.id14458.diff
Sun, Dec 1, 12:27 PM
F3395670: D4506.diff
Sun, Dec 1, 6:51 AM
F3395039: D4506.id14459.diff
Sun, Dec 1, 1:14 AM
Unknown Object (File)
Thu, Nov 28, 10:35 PM
Unknown Object (File)
Sat, Nov 2, 9:50 AM
Unknown Object (File)
Sat, Nov 2, 9:50 AM
Unknown Object (File)
Sat, Nov 2, 9:50 AM
Unknown Object (File)
Sat, Nov 2, 9:50 AM

Details

Summary

Linear: https://linear.app/comm/issue/ENG-1350/investigate-why-new-messages-are-not-displayed-when-keyserver
Introduce 5s delay before running database setup script and migrations in dev mode.
This prevents executing migrations and db setup script while project files are compiled after running yarn dev and nodemon restarts a few times.

Test Plan

I dropped database, and run yarn dev with and without fix, confirming that DB setup was fully completed using logs. Also checked threads table in DB to confirm the initial threads are created.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat added inline comments.
keyserver/src/database/migrations.js
15 ↗(On Diff #14409)

This variable declaration should be grouped with the try-catch that sets it below

This revision is now accepted and ready to land.Jul 12 2022, 12:08 PM
keyserver/src/database/migrations.js
15 ↗(On Diff #14409)

I think it can't be inside try-catch, because it's used in line 30 - out of the block. Or do you mean just moving it to line 19?

keyserver/src/database/migrations.js
15 ↗(On Diff #14409)

Yes that's what I mean

move dbVersion closer to where it's used