Skip to content
This repository was archived by the owner on Dec 21, 2021. It is now read-only.

Commit b2ed376

Browse files
committed
test(memory): Run realtime tests for max 30s or 6k messages. Should reduce flakiness on slow traffic days.
1 parent e1d037f commit b2ed376

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

test/memory/MessageQuantity.test.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,27 +177,36 @@ describe('no memleaks when processing a high quantity of large messages', () =>
177177
}
178178
})
179179

180-
test('realtime', async () => {
181-
// might not work on weekends :/
180+
test.only('realtime', async () => {
182181
const MAX_MEMORY_USAGE = 2e+8 // 300MB
183-
const MAX_MESSAGES = 10000
182+
const MAX_MESSAGES = 6000
183+
const MAX_TEST_TIME = 60000
184184
sub = await client.subscribe({
185185
stream: stream.id,
186186
}, onMessage(MAX_MESSAGES))
187+
const t = setTimeout(() => {
188+
sub.unsubscribe()
189+
}, MAX_TEST_TIME) // run for 60s or 6k messages
187190
await sub.onDone()
191+
clearTimeout(t)
188192
validate(MAX_MEMORY_USAGE)
189193
}, 120000)
190194

191195
test('resendSubscribe', async () => {
192-
// might not work on weekends :/
193196
const MAX_MEMORY_USAGE = 2e+8 // 300MB
194-
const MAX_MESSAGES = 10000
197+
const MAX_MESSAGES = 6000
198+
const MAX_TEST_TIME = 60000
195199
sub = await client.subscribe({
196200
stream: stream.id,
197201
resend: {
198202
last: Math.floor(MAX_MESSAGES / 2),
199203
}
200204
}, onMessage(MAX_MESSAGES))
205+
const t = setTimeout(() => {
206+
sub.unsubscribe()
207+
}, MAX_TEST_TIME) // run for 60s or 6k messages
208+
await sub.onDone()
209+
clearTimeout(t)
201210
await sub.onDone()
202211
validate(MAX_MEMORY_USAGE)
203212
}, 120000)

0 commit comments

Comments
 (0)