new api refactor setup
This commit is contained in:
@@ -42,11 +42,10 @@ async function authenticateDB() {
|
||||
|
||||
async function ensureAuthenticated() {
|
||||
try {
|
||||
console.log("⏳ Ensuring authentication with SurrealDB...");
|
||||
await db.query("RETURN 1");
|
||||
} catch (error: any) {
|
||||
if (error.status === 401) {
|
||||
console.warn("⚠️ Token expired. Attempting reconnection...");
|
||||
console.warn("⚠️ SurrealDB Auth token expired. Attempting reconnection...");
|
||||
try {
|
||||
// Full reconnection instead of just re-authentication
|
||||
await db.close();
|
||||
|
||||
Reference in New Issue
Block a user