Add CallLinkDeleteManager to retry and ensure deletion
This commit is contained in:
parent
8b627b3f1a
commit
a40d54099c
8 changed files with 229 additions and 89 deletions
|
@ -586,7 +586,7 @@ type ReadableInterface = {
|
|||
getCallLinkByRoomId: (roomId: string) => CallLinkType | undefined;
|
||||
getCallLinkRecordByRoomId: (roomId: string) => CallLinkRecord | undefined;
|
||||
getAllCallLinkRecordsWithAdminKey(): ReadonlyArray<CallLinkRecord>;
|
||||
getAllMarkedDeletedCallLinks(): ReadonlyArray<CallLinkType>;
|
||||
getAllMarkedDeletedCallLinkRoomIds(): ReadonlyArray<string>;
|
||||
getMessagesBetween: (
|
||||
conversationId: string,
|
||||
options: GetMessagesBetweenOptions
|
||||
|
|
|
@ -181,7 +181,7 @@ import {
|
|||
updateCallLinkState,
|
||||
beginDeleteAllCallLinks,
|
||||
getAllCallLinkRecordsWithAdminKey,
|
||||
getAllMarkedDeletedCallLinks,
|
||||
getAllMarkedDeletedCallLinkRoomIds,
|
||||
finalizeDeleteCallLink,
|
||||
beginDeleteCallLink,
|
||||
deleteCallLinkFromSync,
|
||||
|
@ -313,7 +313,7 @@ export const DataReader: ServerReadableInterface = {
|
|||
getCallLinkByRoomId,
|
||||
getCallLinkRecordByRoomId,
|
||||
getAllCallLinkRecordsWithAdminKey,
|
||||
getAllMarkedDeletedCallLinks,
|
||||
getAllMarkedDeletedCallLinkRoomIds,
|
||||
getMessagesBetween,
|
||||
getNearbyMessageFromDeletedSet,
|
||||
getMostRecentAddressableMessages,
|
||||
|
|
|
@ -305,16 +305,13 @@ export function getAllCallLinkRecordsWithAdminKey(
|
|||
.map(item => callLinkRecordSchema.parse(item));
|
||||
}
|
||||
|
||||
export function getAllMarkedDeletedCallLinks(
|
||||
export function getAllMarkedDeletedCallLinkRoomIds(
|
||||
db: ReadableDB
|
||||
): ReadonlyArray<CallLinkType> {
|
||||
): ReadonlyArray<string> {
|
||||
const [query] = sql`
|
||||
SELECT * FROM callLinks WHERE deleted = 1;
|
||||
SELECT roomId FROM callLinks WHERE deleted = 1;
|
||||
`;
|
||||
return db
|
||||
.prepare(query)
|
||||
.all()
|
||||
.map(item => callLinkFromRecord(callLinkRecordSchema.parse(item)));
|
||||
return db.prepare(query).pluck().all();
|
||||
}
|
||||
|
||||
// TODO: Run this after uploading storage records, maybe periodically on startup
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue