Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32845862
D5530.1768094939.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D5530.1768094939.diff
View Options
diff --git a/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js b/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/scripts/create-many-threads-to-trigger-crash-loop.js
@@ -0,0 +1,42 @@
+// @flow
+import ashoat from 'lib/facts/ashoat';
+
+import { createThread } from '../creators/thread-creator';
+import { createScriptViewer } from '../session/scripts';
+import { main } from './utils';
+
+const testUserID = '';
+const numOfThreads = 1000;
+
+async function createThreads(
+ n: number,
+ spammedUserID: string,
+ spammingUserID: string,
+): Promise<$ReadOnlyArray<string>> {
+ const threads = [];
+ const viewer = createScriptViewer(spammingUserID);
+ 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;
+}
+
+// This script is used to trigger socket crash loop
+// Linear issue: https://linear.app/comm/issue/ENG-2075/reproduce-socket-crash-loop-in-production-with-artificial-test-data
+// Usage: set testUserID to the user you wish to trigger the crash loop for,
+// set iOS physical device networking profile to 3G and run the script,
+// open comm on physical device once the script has finnished
+// the app should be in a crash loop
+
+async function createManyThreadsToTriggerCrashLoop() {
+ await createThreads(numOfThreads, testUserID, ashoat.id);
+}
+
+main([createManyThreadsToTriggerCrashLoop]);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 11, 1:28 AM (5 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5914703
Default Alt Text
D5530.1768094939.diff (1 KB)
Attached To
Mode
D5530: [keyserver] Add a script for triggering socket crash loop
Attached
Detach File
Event Timeline
Log In to Comment