From b8d246592d468f5206b88d8da06f1fc4d439f29e Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Tue, 21 Mar 2023 18:27:14 -0500 Subject: [PATCH] Minor bug fixes & build job (#89) --- .github/workflows/test.yml | 21 +++++++++++++++++++ .../platform/src/campaigns/CampaignSendJob.ts | 2 +- apps/platform/src/config/scheduler.ts | 3 ++- apps/ui/src/ui/form/EntityIdPicker.tsx | 1 - 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e312e0a8..8da802a5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,3 +76,24 @@ jobs: BASE_URL: https://parcelvoy.com QUEUE_DRIVER: memory STORAGE_DRIVER: s3 + + build: + needs: lint + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v1 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Node Install + run: | + npm install + - name: Build + run: | + npm run build diff --git a/apps/platform/src/campaigns/CampaignSendJob.ts b/apps/platform/src/campaigns/CampaignSendJob.ts index ee104ca1..a386fe82 100644 --- a/apps/platform/src/campaigns/CampaignSendJob.ts +++ b/apps/platform/src/campaigns/CampaignSendJob.ts @@ -17,7 +17,7 @@ export default class CampaignSendJob extends Job { await campaignSendReadyQuery(campaign.id) .stream(async function(stream) { - for await (const { user_id, ...campaign } of stream) { + for await (const { user_id } of stream) { await sendCampaign(campaign, user_id) } }) diff --git a/apps/platform/src/config/scheduler.ts b/apps/platform/src/config/scheduler.ts index 0d1db66e..b798657a 100644 --- a/apps/platform/src/config/scheduler.ts +++ b/apps/platform/src/config/scheduler.ts @@ -99,7 +99,8 @@ class SchedulerLock { // Clean up any oddball pending jobs that are missed // Randomly run this job to reduce chance of deadlocks if (randomInt() < 10) { - await JobLock.delete(qb => qb.where('expiration', '<=', new Date())) + await sleep(randomInt(5, 20)) + await JobLock.delete(qb => qb.where('expiration', '<=', new Date()).orderBy('id')) } return acquired diff --git a/apps/ui/src/ui/form/EntityIdPicker.tsx b/apps/ui/src/ui/form/EntityIdPicker.tsx index 0d8b3a76..955965e2 100644 --- a/apps/ui/src/ui/form/EntityIdPicker.tsx +++ b/apps/ui/src/ui/form/EntityIdPicker.tsx @@ -76,7 +76,6 @@ export function EntityIdPicker({ value && displayValue(value)} - disabled={Boolean(value && !entity)} onChange={e => setQuery(e.target.value)} onBlur={onBlur} ref={(input: HTMLInputElement) => {