Skip to content

Commit

Permalink
skip deleted proposals when checking isJobManaged
Browse files Browse the repository at this point in the history
  • Loading branch information
eutopian committed Aug 29, 2024
1 parent 7c248e7 commit 9899dd0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/tricky-eagles-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

skip checking isJobManaged if the proposal in fms has already been deleted #changed
1 change: 1 addition & 0 deletions core/services/feeds/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,7 @@ SELECT exists (
FROM job_proposals
INNER JOIN jobs ON job_proposals.external_job_id = jobs.external_job_id
WHERE jobs.id = $1
AND job_proposals.status <> 'deleted'
);
`

Expand Down
8 changes: 8 additions & 0 deletions core/services/feeds/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,14 @@ func Test_ORM_IsJobManaged(t *testing.T) {
isManaged, err = orm.IsJobManaged(ctx, int64(j.ID))
require.NoError(t, err)
assert.True(t, isManaged)

// delete the proposal
err = orm.DeleteProposal(ctx, jpID)
require.NoError(t, err)

isManaged, err = orm.IsJobManaged(ctx, int64(j.ID))
require.NoError(t, err)
assert.False(t, isManaged)
}

// Helpers
Expand Down

0 comments on commit 9899dd0

Please sign in to comment.