diff --git a/keyserver/src/scripts/trigger-socket-crash-loop.js b/keyserver/src/scripts/trigger-socket-crash-loop.js new file mode 100644 --- /dev/null +++ b/keyserver/src/scripts/trigger-socket-crash-loop.js @@ -0,0 +1,31 @@ +// @flow +import ashoat from 'lib/facts/ashoat'; + +import { createThread } from '../creators/thread-creator'; +import { createScriptViewer } from '../session/scripts'; +import { main } from './utils'; + +const spammedUserID = '92942'; // test users ID +const ashoatID = ashoat.id; + +async function createThreads(n: number): Promise> { + const threads = []; + const viewer = createScriptViewer(ashoatID); + const initialMemberIDs = [spammedUserID]; + const threadRequest = { type: 3, initialMemberIDs, parentThreadID: '1' }; + + for (let i = 0; i < n; i++) { + const threadResponse = await createThread(viewer, threadRequest); + if (threadResponse.newThreadID) { + const threadID: string = threadResponse.newThreadID; + threads.push(threadID); + } + } + return threads; +} + +async function triggerSocketCrashLoop() { + await createThreads(1000); +} + +main([triggerSocketCrashLoop]);