Merge branch 'dev'
This commit is contained in:
commit
7c8bbc17c8
|
|
@ -3454,11 +3454,23 @@ app.get('/', (c) => {
|
||||||
// DATABASE INITIALIZATION & SERVER START
|
// DATABASE INITIALIZATION & SERVER START
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// Initialize database on startup
|
// Initialize database on startup with retries (Docker networking may take a moment)
|
||||||
initDatabase().catch(err => {
|
(async () => {
|
||||||
console.error('EncryptID: Failed to initialize database', err);
|
const maxRetries = 5;
|
||||||
process.exit(1);
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||||
});
|
try {
|
||||||
|
await initDatabase();
|
||||||
|
return;
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`EncryptID: Database init attempt ${attempt}/${maxRetries} failed:`, (err as Error).message);
|
||||||
|
if (attempt === maxRetries) {
|
||||||
|
console.error('EncryptID: All database init attempts exhausted, exiting');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
await new Promise(r => setTimeout(r, attempt * 2000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// Clean expired challenges and recovery tokens every 10 minutes
|
// Clean expired challenges and recovery tokens every 10 minutes
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue