Skip to content

Commit 5013990

Browse files
improvement(cleanup): reuse existing jobs for row limits
1 parent 0ccd2f1 commit 5013990

48 files changed

Lines changed: 901 additions & 3052 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/sim/app/api/logs/cleanup/route.test.ts‎

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ for (const [path, GET, type, limit] of [
2323
beforeEach(() => {
2424
vi.clearAllMocks()
2525
auth.mockReturnValue(null)
26-
bounded.mockResolvedValue({ runId: 'run-one', mode: 'bounded' })
26+
bounded.mockResolvedValue({ triggered: true, runId: 'run-one', limits: { [limit]: 2 } })
2727
scheduled.mockResolvedValue({
2828
jobIds: ['batch-one'],
2929
jobCount: 1,
@@ -46,20 +46,17 @@ for (const [path, GET, type, limit] of [
4646
expect(bounded).not.toHaveBeenCalled()
4747
})
4848
it('accepts one bounded run', async () => {
49-
const response = await GET(request(`?${limit}=2&requestId=wave-1&dryRun=true`))
49+
const response = await GET(request(`?${limit}=2`))
5050
expect(response.status).toBe(202)
51-
expect(bounded).toHaveBeenCalledWith(
52-
type,
53-
expect.objectContaining({
54-
limits: expect.objectContaining({ [limit]: 2 }),
55-
requestId: 'wave-1',
56-
dryRun: true,
57-
batchSize: 25,
58-
})
59-
)
51+
expect(bounded).toHaveBeenCalledWith(type, { [limit]: 2 })
52+
expect(await response.json()).toEqual({
53+
triggered: true,
54+
runId: 'run-one',
55+
limits: { [limit]: 2 },
56+
})
6057
expect(scheduled).not.toHaveBeenCalled()
6158
})
62-
it.each(['?dryRun=true', '?unknown=1', '?batchSize=3', `?${limit}=2&${limit}=3&requestId=r`])(
59+
it.each(['?dryRun=true', '?unknown=1', '?batchSize=3', `?${limit}=2&${limit}=3`])(
6360
'rejects invalid query %s',
6461
async (query) => {
6562
expect((await GET(request(query))).status).toBe(400)
@@ -69,7 +66,7 @@ for (const [path, GET, type, limit] of [
6966
)
7067
it('reports a dispatch failure', async () => {
7168
bounded.mockRejectedValue(new Error('Trigger unavailable'))
72-
expect((await GET(request(`?${limit}=2&requestId=r`))).status).toBe(500)
69+
expect((await GET(request(`?${limit}=2`))).status).toBe(500)
7370
})
7471
})
7572
}

‎apps/sim/app/api/webhooks/outbox/process/route.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { enterpriseOwnerClaimOutboxHandlers } from '@/lib/billing/enterprise-own
99
import { enterpriseIssuanceOutboxHandlers } from '@/lib/billing/enterprise-provisioning'
1010
import { membershipBillingOutboxHandlers } from '@/lib/billing/organizations/membership-reconciliation'
1111
import { billingOutboxHandlers } from '@/lib/billing/webhooks/outbox-handlers'
12-
import { retentionStorageOutboxHandlers } from '@/lib/cleanup/storage-outbox'
1312
import { processOutboxEvents } from '@/lib/core/outbox/service'
1413
import { DeadlineExceededError } from '@/lib/core/utils/deadline'
1514
import { generateRequestId } from '@/lib/core/utils/request'
@@ -34,7 +33,6 @@ export const dynamic = 'force-dynamic'
3433
export const maxDuration = 800
3534

3635
const handlers = {
37-
...retentionStorageOutboxHandlers,
3836
...slackSearchOutboxHandlers,
3937
...adminInvitationOperationOutboxHandlers,
4038
...adminMemberOperationOutboxHandlers,

‎apps/sim/background/cleanup-bounded.test.ts‎

Lines changed: 0 additions & 278 deletions
This file was deleted.

0 commit comments

Comments
 (0)