feat: add async SQLite on Node 24 and improve messaging diagnostics (#520)
Move database work off the main thread on Node.js 24 and improve message handling and runtime diagnostics. Preserve migration, restart, and concurrency coverage with the async SQLite driver.
This commit is contained in:
1 parent
20f48d11ec
commit
c7428363cb
170 files changed
+7748
-3913
No files matched your search
@@ -327,7 +327,7 @@ describe('buildApiContext getLoginInfo', () => {
|
||||
});
|
||||
|
||||
describe('buildApiContext message-store passthroughs', () => {
|
||||
it('reads events and metas through the message store', () => {
|
||||
it('reads events and metas through the message store', async () => {
|
||||
const storedEvent = {
|
||||
post_type: 'message',
|
||||
message_type: 'group',
|
||||
@@ -339,14 +339,14 @@ describe('buildApiContext message-store passthroughs', () => {
|
||||
events.set(-55, storedEvent);
|
||||
metas.set(-55, storedMeta);
|
||||
|
||||
expect(api.getMessage(-55)).toEqual({
|
||||
expect(await api.getMessage(-55)).toEqual({
|
||||
post_type: 'message',
|
||||
message_type: 'group',
|
||||
message_id: -55,
|
||||
raw_message: 'stored',
|
||||
});
|
||||
expect(api.getMessage(1)).toBeNull();
|
||||
expect(api.getMessageMeta(-55)).toEqual({
|
||||
expect(await api.getMessage(1)).toBeNull();
|
||||
expect(await api.getMessageMeta(-55)).toEqual({
|
||||
isGroup: true,
|
||||
targetId: GROUP_ID,
|
||||
sequence: 91,
|
||||
@@ -358,18 +358,18 @@ describe('buildApiContext message-store passthroughs', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('stores meta batches on the message store', () => {
|
||||
it('stores meta batches on the message store', async () => {
|
||||
const storeMetas = vi.fn();
|
||||
const { api } = makeRef({ messageStore: { storeMetas } });
|
||||
const entries = [{ messageId: -12, meta: privateMeta({ sequence: 8 }) }];
|
||||
|
||||
api.cacheMessageMetas(entries);
|
||||
await api.cacheMessageMetas(entries);
|
||||
|
||||
expect(storeMetas).toHaveBeenCalledOnce();
|
||||
expect(storeMetas).toHaveBeenCalledWith(entries);
|
||||
});
|
||||
|
||||
it('lists read sessions from the current identity group ids', () => {
|
||||
it('lists read sessions from the current identity group ids', async () => {
|
||||
const listReadSessions = vi.fn(() => ({
|
||||
groupIds: [710101, 710102],
|
||||
privateUserIds: [50001],
|
||||
@@ -381,7 +381,7 @@ describe('buildApiContext message-store passthroughs', () => {
|
||||
messageStore: { listReadSessions },
|
||||
});
|
||||
|
||||
expect(api.listReadSessions()).toEqual({
|
||||
expect(await api.listReadSessions()).toEqual({
|
||||
groupIds: [710101, 710102],
|
||||
privateUserIds: [50001],
|
||||
});
|
||||
@@ -1059,7 +1059,7 @@ describe('buildApiContext media', () => {
|
||||
await expect(api.getImageInfo('missing.jpg')).resolves.toBeNull();
|
||||
});
|
||||
|
||||
it('returns cached record info and refetches a missing group ptt url', async () => {
|
||||
it('resolves indexed record info through the group ptt API', async () => {
|
||||
const getPttUrl = vi.fn(async () => 'https://ptt.example/group');
|
||||
const updateRecordUrl = vi.fn();
|
||||
const mediaNode = { fileUuid: 'uuid-1' };
|
||||
|
||||
Reference in new issue
Block a user