File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
sentry/src/test/java/io/sentry Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -214,4 +214,18 @@ class SentryExecutorServiceTest {
214214 repeat(1000 ) { sentryExecutor.schedule({}, TimeUnit .DAYS .toMillis(1 )) }
215215 assertEquals(1000 , executor.queue.size)
216216 }
217+
218+ @Test
219+ fun `SentryExecutorService purges cancelled jobs when limit is reached` () {
220+ val executor = ScheduledThreadPoolExecutor (1 )
221+ val sentryExecutor = SentryExecutorService (executor, null )
222+ // Post 1k jobs after 1 day, to test they are all accepted
223+ repeat(1000 ) {
224+ val future = sentryExecutor.schedule({}, TimeUnit .DAYS .toMillis(1 ))
225+ future.cancel(true )
226+ }
227+ assertEquals(1000 , executor.queue.size)
228+ sentryExecutor.submit { }
229+ assertEquals(1 , executor.queue.size)
230+ }
217231}
You can’t perform that action at this time.
0 commit comments