-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixing for postgres and memory backends, polish the unit tests
- Loading branch information
1 parent
22fe80c
commit 68ff6c5
Showing
12 changed files
with
451 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
backends/postgres/migrations/20240101191302_add_unique_on_fingerprint_constraint.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
DROP CONSTRAINT neoq_jobs_fingerprint_constraint_idx; | ||
CREATE INDEX IF NOT EXISTS neoq_jobs_fingerprint_idx ON neoq_jobs (fingerprint, status); | ||
CREATE UNIQUE INDEX IF NOT EXISTS neoq_jobs_fingerprint_unique_idx ON neoq_jobs (queue, fingerprint, status) WHERE NOT (status = 'processed'); |
5 changes: 4 additions & 1 deletion
5
backends/postgres/migrations/20240101191302_add_unique_on_fingerprint_constraint.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
ALTER TABLE neoq_jobs ADD CONSTRAINT neoq_jobs_fingerprint_constraint_idx UNIQUE (queue, fingerprint, status, ran_at); | ||
DROP INDEX IF EXISTS neoq_jobs_fingerprint_idx; | ||
DROP INDEX IF EXISTS neoq_jobs_fingerprint_unique_idx; | ||
|
||
CREATE UNIQUE INDEX IF NOT EXISTS neoq_jobs_fingerprint_unique_idx ON neoq_jobs (queue, status, fingerprint, ran_at); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package backends | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/acaloiaro/neoq" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
type NeoQTestSuite struct { | ||
suite.Suite | ||
NeoQ neoq.Neoq | ||
} | ||
|
||
// NewNeoQTestSuite constructs a new NeoQ test suite that can be used to test | ||
// any impementation of the queue | ||
func NewNeoQTestSuite(q neoq.Neoq) *NeoQTestSuite { | ||
n := new(NeoQTestSuite) | ||
n.NeoQ = q | ||
return n | ||
} | ||
|
||
func (s *NeoQTestSuite) Run(t *testing.T) { | ||
suite.Run(t, s) | ||
} | ||
|
||
func (s *NeoQTestSuite) TearDownSuite() { | ||
s.NeoQ.Shutdown(context.Background()) | ||
} |
Oops, something went wrong.