also looking at this
fix: hydrate durable registry snapshots before serving writes
#244
11 files
+202
-35
| @@ -6846,7 +6846,16 @@ if (import.meta.main) { | ||
| 6846 | 6846 | // Ensure auth storage uses the same DynamoDB table as the registry |
| 6847 | 6847 | const authStorage = createAuthStorage(dynamoTable, awsRegion) |
| 6848 | 6848 | |
| 6849 | const { start } = createServer(registry, port, analytics, undefined, undefined, undefined, authStorage) | |
| 6849 | const zigStorage = createZigStorage() | |
| 6850 | const phpStorage = createPhpStorage() | |
| 6851 | // Hydrate durable state before accepting any request that can mutate it. | |
| 6852 | // Only a confirmed missing object can initialize an empty registry. | |
| 6853 | await Promise.all([registry.metadata, analytics, authStorage, zigStorage, phpStorage].map(async (store) => { | |
| 6854 | if ('ready' in store && typeof store.ready === 'function') | |
| 6855 | await store.ready() | |
| 6856 | })) | |
| 6857 | ||
| 6858 | const { start } = createServer(registry, port, analytics, zigStorage, undefined, phpStorage, authStorage) | |
| 6850 | 6859 | start() |
| 6851 | 6860 | |
| 6852 | 6861 | console.log('\nEnvironment:') |