Fix background task still running twice, and add a check to prevent that happening again (double expiry).
This commit is contained in:
@@ -24,7 +24,7 @@ const rpId = computed(() => props.settings?.rp_id || 'the configured domain')
|
||||
<template v-else-if="dialog.type==='role-update'">Edit Role</template>
|
||||
<template v-else-if="dialog.type==='user-create'">Add User To Role</template>
|
||||
<template v-else-if="dialog.type==='user-update-name'">Edit User Name</template>
|
||||
<template v-else-if="dialog.type==='perm-create' || dialog.type==='perm-display'">{{ dialog.type === 'perm-create' ? 'Create Permission' : 'Edit Permission Display' }}</template>
|
||||
<template v-else-if="dialog.type==='perm-create' || dialog.type==='perm-display'">{{ dialog.type === 'perm-create' ? 'Create Permission' : 'Edit Permission' }}</template>
|
||||
<template v-else-if="dialog.type==='confirm'">Confirm</template>
|
||||
</h3>
|
||||
<form @submit.prevent="$emit('submitDialog')" class="modal-form">
|
||||
|
||||
@@ -73,6 +73,14 @@ async def start_background():
|
||||
if loop is not task_loop:
|
||||
_logger.debug("Background task in different event loop, restarting")
|
||||
_background_task = None
|
||||
else:
|
||||
# Task is running in the same event loop - this is an error
|
||||
raise RuntimeError(
|
||||
"Background task is already running. "
|
||||
"start_background() must not be called multiple times in the same event loop."
|
||||
)
|
||||
except RuntimeError:
|
||||
raise # Re-raise RuntimeError from above
|
||||
except Exception as e:
|
||||
_logger.debug("Error checking background task loop: %s, restarting", e)
|
||||
_background_task = None
|
||||
|
||||
@@ -11,7 +11,6 @@ from uvicorn import Config, Server
|
||||
from paskia import globals as _globals
|
||||
from paskia.bootstrap import bootstrap_if_needed
|
||||
from paskia.config import PaskiaConfig
|
||||
from paskia.db import start_background
|
||||
from paskia.db.background import flush
|
||||
from paskia.fastapi import app as fastapi_app
|
||||
from paskia.fastapi import reset as reset_cmd
|
||||
@@ -216,8 +215,6 @@ def main():
|
||||
exit_code = reset_cmd.run(args.reset_query)
|
||||
raise SystemExit(exit_code)
|
||||
|
||||
await start_background()
|
||||
|
||||
if len(endpoints) > 1:
|
||||
async with asyncio.TaskGroup() as tg:
|
||||
for ep in endpoints:
|
||||
|
||||
@@ -108,7 +108,7 @@ async def admin_list_orgs(request: Request, auth=AUTH_COOKIE):
|
||||
"uuid": str(r.uuid),
|
||||
"org": str(r.org),
|
||||
"display_name": r.display_name,
|
||||
"permissions": r.permissions,
|
||||
"permissions": list(r.permissions.keys()),
|
||||
}
|
||||
|
||||
async def org_to_dict(o):
|
||||
|
||||
Reference in New Issue
Block a user