Parallelize SQL queries
This commit is contained in:
parent
86b4da1ec2
commit
c64762858e
178 changed files with 3377 additions and 3618 deletions
|
@ -4,18 +4,17 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
_getAllMessages,
|
||||
saveMessages,
|
||||
getMessagesWithVisualMediaAttachments,
|
||||
getMessagesWithFileAttachments,
|
||||
} = dataInterface;
|
||||
} = DataReader;
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/allMedia', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,18 +4,14 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
import { DurationInSeconds } from '../../util/durations';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
_getAllMessages,
|
||||
saveMessages,
|
||||
getConversationMessageStats,
|
||||
} = dataInterface;
|
||||
const { _getAllMessages, getConversationMessageStats } = DataReader;
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/conversationSummary', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,18 +4,13 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
_getAllMessages,
|
||||
saveMessages,
|
||||
saveMessage,
|
||||
searchMessages,
|
||||
} = dataInterface;
|
||||
const { _getAllMessages, searchMessages } = DataReader;
|
||||
const { removeAll, saveMessages, saveMessage } = DataWriter;
|
||||
|
||||
describe('sql/searchMessages', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
|
||||
import { CallMode } from '../../types/Calling';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
@ -28,14 +28,9 @@ import {
|
|||
FAKE_CALL_LINK_WITH_ADMIN_KEY,
|
||||
} from '../../test-both/helpers/fakeCallLink';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
getCallHistoryGroups,
|
||||
getCallHistoryGroupsCount,
|
||||
insertCallLink,
|
||||
saveCallHistory,
|
||||
saveConversation,
|
||||
} = dataInterface;
|
||||
const { getCallHistoryGroups, getCallHistoryGroupsCount } = DataReader;
|
||||
const { removeAll, insertCallLink, saveCallHistory, saveConversation } =
|
||||
DataWriter;
|
||||
|
||||
function toGroup(calls: Array<CallHistoryDetails>): CallHistoryGroup {
|
||||
const firstCall = calls.at(0);
|
||||
|
|
|
@ -4,17 +4,13 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
_getAllMessages,
|
||||
saveMessages,
|
||||
getCallHistoryMessageByCallId,
|
||||
} = dataInterface;
|
||||
const { _getAllMessages, getCallHistoryMessageByCallId } = DataReader;
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/getCallHistoryMessageByCallId', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -5,16 +5,12 @@ import { assert } from 'chai';
|
|||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types';
|
||||
|
||||
const {
|
||||
saveMessages,
|
||||
_getAllMessages,
|
||||
_removeAllMessages,
|
||||
getMessagesBetween,
|
||||
} = dataInterface;
|
||||
const { _getAllMessages, getMessagesBetween } = DataReader;
|
||||
const { saveMessages, _removeAllMessages } = DataWriter;
|
||||
|
||||
describe('sql/getMessagesBetween', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,17 +4,13 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types';
|
||||
|
||||
const {
|
||||
saveMessages,
|
||||
_getAllMessages,
|
||||
_removeAllMessages,
|
||||
getNearbyMessageFromDeletedSet,
|
||||
} = dataInterface;
|
||||
const { _getAllMessages, getNearbyMessageFromDeletedSet } = DataReader;
|
||||
const { saveMessages, _removeAllMessages } = DataWriter;
|
||||
|
||||
describe('sql/getNearbyMessageFromDeletedSet', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { assert } from 'chai';
|
|||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import { times } from 'lodash';
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
|
||||
import { CallMode } from '../../types/Calling';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
@ -17,12 +17,9 @@ import {
|
|||
} from '../../types/CallDisposition';
|
||||
import type { MaybeStaleCallHistory } from '../../sql/Server';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
getRecentStaleRingsAndMarkOlderMissed,
|
||||
saveCallHistory,
|
||||
getAllCallHistory,
|
||||
} = dataInterface;
|
||||
const { getAllCallHistory } = DataReader;
|
||||
const { getRecentStaleRingsAndMarkOlderMissed, removeAll, saveCallHistory } =
|
||||
DataWriter;
|
||||
|
||||
describe('sql/getRecentStaleRingsAndMarkOlderMissed', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const { _getAllMessages, getRecentStoryReplies, removeAll, saveMessages } =
|
||||
dataInterface;
|
||||
const { _getAllMessages, getRecentStoryReplies } = DataReader;
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/getRecentStoryReplies', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { ReactionType } from '../../types/Reactions';
|
||||
|
@ -13,17 +13,16 @@ import { DurationInSeconds } from '../../util/durations';
|
|||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||
|
||||
const { _getAllReactions, _getAllMessages, getTotalUnreadForConversation } =
|
||||
DataReader;
|
||||
const {
|
||||
_removeAllMessages,
|
||||
_removeAllReactions,
|
||||
_getAllReactions,
|
||||
_getAllMessages,
|
||||
addReaction,
|
||||
saveMessages,
|
||||
getTotalUnreadForConversation,
|
||||
getUnreadByConversationAndMarkRead,
|
||||
getUnreadReactionsAndMarkRead,
|
||||
} = dataInterface;
|
||||
} = DataWriter;
|
||||
|
||||
const UNREAD_REACTION = { readStatus: ReactionReadStatus.Unread };
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
import { constantTimeEqual, getRandomBytes } from '../../Crypto';
|
||||
import { singleProtoJobQueue } from '../../jobs/singleProtoJobQueue';
|
||||
|
@ -12,17 +12,19 @@ import { singleProtoJobQueue } from '../../jobs/singleProtoJobQueue';
|
|||
const {
|
||||
_getAllSentProtoMessageIds,
|
||||
_getAllSentProtoRecipients,
|
||||
getAllSentProtos,
|
||||
} = DataReader;
|
||||
const {
|
||||
deleteSentProtoByMessageId,
|
||||
deleteSentProtoRecipient,
|
||||
deleteSentProtosOlderThan,
|
||||
getAllSentProtos,
|
||||
getSentProtoByRecipient,
|
||||
insertProtoRecipients,
|
||||
insertSentProto,
|
||||
removeAllSentProtos,
|
||||
removeMessage,
|
||||
saveMessage,
|
||||
} = dataInterface;
|
||||
} = DataWriter;
|
||||
|
||||
describe('sql/sendLog', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
|
||||
const { removeAll, _getAllMessages, saveMessages, getAllStories } =
|
||||
dataInterface;
|
||||
const { _getAllMessages, getAllStories } = DataReader;
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/stories', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,23 +4,26 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
import { generateStoryDistributionId } from '../../types/StoryDistributionId';
|
||||
|
||||
import type { StoryDistributionWithMembersType } from '../../sql/Interface';
|
||||
|
||||
const {
|
||||
_deleteAllStoryDistributions,
|
||||
_getAllStoryDistributionMembers,
|
||||
_getAllStoryDistributions,
|
||||
getAllStoryDistributionsWithMembers,
|
||||
} = DataReader;
|
||||
|
||||
const {
|
||||
_deleteAllStoryDistributions,
|
||||
createNewStoryDistribution,
|
||||
deleteStoryDistribution,
|
||||
getAllStoryDistributionsWithMembers,
|
||||
modifyStoryDistribution,
|
||||
modifyStoryDistributionMembers,
|
||||
modifyStoryDistributionWithMembers,
|
||||
} = dataInterface;
|
||||
} = DataWriter;
|
||||
|
||||
describe('sql/storyDistribution', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { StoryReadType } from '../../sql/Interface';
|
||||
|
||||
const {
|
||||
_getAllStoryReads,
|
||||
_deleteAllStoryReads,
|
||||
addNewStoryRead,
|
||||
getLastStoryReadsForAuthor,
|
||||
} = dataInterface;
|
||||
const { _getAllStoryReads, getLastStoryReadsForAuthor } = DataReader;
|
||||
|
||||
const { _deleteAllStoryReads, addNewStoryRead } = DataWriter;
|
||||
|
||||
describe('sql/storyReads', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
|
@ -4,22 +4,22 @@
|
|||
import { assert } from 'chai';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import dataInterface from '../../sql/Client';
|
||||
import { DataReader, DataWriter } from '../../sql/Client';
|
||||
import { generateAci } from '../../types/ServiceId';
|
||||
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus';
|
||||
|
||||
const {
|
||||
removeAll,
|
||||
_getAllMessages,
|
||||
saveMessages,
|
||||
getMessageMetricsForConversation,
|
||||
getNewerMessagesByConversation,
|
||||
getOlderMessagesByConversation,
|
||||
getTotalUnreadMentionsOfMeForConversation,
|
||||
getOldestUnreadMentionOfMeForConversation,
|
||||
} = dataInterface;
|
||||
} = DataReader;
|
||||
|
||||
const { removeAll, saveMessages } = DataWriter;
|
||||
|
||||
describe('sql/timelineFetches', () => {
|
||||
beforeEach(async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue