refactor: move timeline scheduler to isolated service

This commit is contained in:
Ruslan Bakiev
2026-02-23 10:58:55 +07:00
parent 2b5aab1210
commit 70369255a2
10 changed files with 354 additions and 168 deletions

View File

@@ -77,7 +77,15 @@ async function validateSessionFromPeer(peer: any) {
}
async function computeTeamSignature(teamId: string) {
const [omniMessageMax, contactMax, contactMessageMax, telegramConnectionMax, contactInboxMax, inboxPrefMax] = await Promise.all([
const [
omniMessageMax,
contactMax,
contactMessageMax,
telegramConnectionMax,
contactInboxMax,
inboxPrefMax,
clientTimelineEntryMax,
] = await Promise.all([
prisma.omniMessage.aggregate({
where: { teamId },
_max: { updatedAt: true },
@@ -102,6 +110,10 @@ async function computeTeamSignature(teamId: string) {
where: { teamId },
_max: { updatedAt: true },
}),
prisma.clientTimelineEntry.aggregate({
where: { teamId },
_max: { updatedAt: true },
}),
]);
return [
@@ -111,6 +123,7 @@ async function computeTeamSignature(teamId: string) {
telegramConnectionMax._max.updatedAt?.toISOString() ?? "",
contactInboxMax._max.updatedAt?.toISOString() ?? "",
inboxPrefMax._max.updatedAt?.toISOString() ?? "",
clientTimelineEntryMax._max.updatedAt?.toISOString() ?? "",
].join("|");
}