feat: web UI chat render, panels, presence + analytics
This commit is contained in:
1 parent
75425d1bee
commit
ed469ba8dd
83 files changed
+6034
-136
No files matched your search
@@ -13,6 +13,7 @@ from userbot import PyroClient
|
||||
from userbot.modules.capture import CaptureContext, build_capture_context
|
||||
from userbot.modules.jobs import JobConsumer
|
||||
from utils.env import env
|
||||
from utils.jobs import enqueue
|
||||
from utils.logging import logger, setup_logging
|
||||
from utils.read.watches import WATCHES_CHANGED_CHANNEL
|
||||
from utils.storage import ContentAddressedStorage
|
||||
@@ -72,6 +73,17 @@ async def _setup_capture(
|
||||
logger.info("[green]Capture context ready.[/]")
|
||||
|
||||
|
||||
async def _enqueue_sync_dialogs(pool: asyncpg.Pool, account_id: int) -> None:
|
||||
existing = await pool.fetchval(
|
||||
"SELECT 1 FROM jobs WHERE account_id = $1 AND kind = 'sync_dialogs' "
|
||||
"AND status IN ('pending', 'running') LIMIT 1",
|
||||
account_id,
|
||||
)
|
||||
if existing is None:
|
||||
await enqueue(pool, account_id, "sync_dialogs", {})
|
||||
logger.info("[green]Queued sync_dialogs.[/]")
|
||||
|
||||
|
||||
async def _listen_changes(
|
||||
clients: list[PyroClient], tasks: set[asyncio.Task]
|
||||
) -> asyncpg.Connection:
|
||||
@@ -134,6 +146,7 @@ async def runner() -> None:
|
||||
await _setup_capture(pool, client, account_id, storage)
|
||||
consumer = JobConsumer(client, pool, account_id)
|
||||
consumer_tasks.append(asyncio.create_task(consumer.run()))
|
||||
await _enqueue_sync_dialogs(pool, account_id)
|
||||
|
||||
if clients:
|
||||
listen_conn = await _listen_changes(clients, reload_tasks)
|
||||
|
||||
Reference in new issue
Block a user