This commit is contained in:
einhornimmond 2025-05-06 17:33:03 +02:00
parent 503ff978a6
commit 9c2ef4bf2e
9 changed files with 40 additions and 32 deletions

View File

@ -1,7 +1,6 @@
export function SecretKeyCryptographyCreateKeyFunc(
salt: string,
password: string,
configLoginAppSecret: Buffer,
configLoginServerKey: Buffer
): bigint;
configLoginServerKey: Buffer,
): bigint

View File

@ -20,10 +20,9 @@ const configLoginServerKey = Buffer.from(CONFIG.LOGIN_SERVER_KEY, 'hex')
let encryptionWorkerPool: Pool | undefined
if (CONFIG.USE_CRYPTO_WORKER === true) {
encryptionWorkerPool = pool(
path.join(__dirname, 'worker.js'),
{ maxQueueSize: 30 * cpus().length },
)
encryptionWorkerPool = pool(path.join(__dirname, 'worker.js'), {
maxQueueSize: 30 * cpus().length,
})
}
// We will reuse this for changePassword

View File

@ -4,4 +4,3 @@ const { SecretKeyCryptographyCreateKeyFunc } = require('./EncryptionWorker')
worker({
SecretKeyCryptographyCreateKeyFunc,
})

View File

@ -20,10 +20,12 @@ async function checkDBVersionUntil(maxRetries = 15, delayMs = 500): Promise<DbCo
} catch (err) {
logger.warn(`Attempt ${attempt}: Waiting for DB...`, err)
}
await new Promise(resolve => setTimeout(resolve, delayMs))
await new Promise((resolve) => setTimeout(resolve, delayMs))
}
logger.fatal(`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`)
logger.fatal(
`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`,
)
throw new Error('Fatal: Database not ready.')
}

View File

@ -11,7 +11,10 @@ export enum DatabaseState {
SAME_VERSION = 'SAME_VERSION',
}
export async function connectToDatabaseServer(maxRetries = 15, delayMs = 500): Promise<Connection | null> {
export async function connectToDatabaseServer(
maxRetries = 15,
delayMs = 500,
): Promise<Connection | null> {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
return await createConnection({
@ -24,7 +27,7 @@ export async function connectToDatabaseServer(maxRetries = 15, delayMs = 500): P
// biome-ignore lint/suspicious/noConsole: no logger present
console.log(`could not connect to database server, retry in ${delayMs} ms`, e)
}
await new Promise(resolve => setTimeout(resolve, delayMs))
await new Promise((resolve) => setTimeout(resolve, delayMs))
}
return null
}

View File

@ -20,12 +20,7 @@ then
bun install --global turbo
fi
# helper functions
log_step() {
local message="$1"
echo -e "\e[34m$message\e[0m" > /dev/tty # blue in console
echo "<p style="color:blue">$message</p>" >> "$UPDATE_HTML" # blue in html
}
# check for parameter
FAST_MODE=false
@ -54,15 +49,6 @@ fi
BRANCH_NAME="$1"
# Debug-Ausgabe
if [ -z "$1" ]; then
echo "Usage: Please provide a branch name as the first argument."
exit 1
fi
log_step "Use branch: $BRANCH_NAME"
if [ "$FAST_MODE" = true ] ; then
log_step "Use fast mode, keep packet manager, turbo and build cache"
fi
# Find current directory & configure paths
set -o allexport
SCRIPT_PATH=$(realpath $0)
@ -73,6 +59,23 @@ PROJECT_ROOT=$SCRIPT_DIR/../..
NGINX_CONFIG_DIR=$SCRIPT_DIR/nginx/sites-available
set +o allexport
# helper functions
log_step() {
local message="$1"
echo -e "\e[34m$message\e[0m" > /dev/tty # blue in console
echo "<p style="color:blue">$message</p>" >> "$UPDATE_HTML" # blue in html
}
# Debug-Ausgabe
if [ -z "$1" ]; then
echo "Usage: Please provide a branch name as the first argument."
exit 1
fi
log_step "Use branch: $BRANCH_NAME"
if [ "$FAST_MODE" = true ] ; then
log_step "Use fast mode, keep packet manager, turbo and build cache"
fi
# enable nvm
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm use default

View File

@ -20,10 +20,12 @@ async function checkDBVersionUntil(maxRetries = 15, delayMs = 500): Promise<DbCo
} catch (err) {
logger.warn(`Attempt ${attempt}: Waiting for DB...`, err)
}
await new Promise(resolve => setTimeout(resolve, delayMs))
await new Promise((resolve) => setTimeout(resolve, delayMs))
}
logger.fatal(`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`)
logger.fatal(
`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`,
)
throw new Error('Fatal: Database not ready.')
}

View File

@ -10,7 +10,6 @@ import cors from './cors'
// import serverContext from './context'
import { plugins } from './plugins'
// graphql
import { schema } from '@/graphql/schema'

View File

@ -18,10 +18,12 @@ async function checkDBVersionUntil(maxRetries = 15, delayMs = 500): Promise<DbCo
} catch (err) {
logger.warn(`Attempt ${attempt}: Waiting for DB...`, err)
}
await new Promise(resolve => setTimeout(resolve, delayMs))
await new Promise((resolve) => setTimeout(resolve, delayMs))
}
logger.fatal(`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`)
logger.fatal(
`Fatal: Could not connect to database or version check failed after ${maxRetries} attempts.`,
)
throw new Error('Fatal: Database not ready.')
}