Skip to content

Commit

Permalink
Merge pull request #350 from dmitry-vychikov/feature/#348-dequeue-per…
Browse files Browse the repository at this point in the history
…formance

[#348] Improve dequeue performance
  • Loading branch information
azygis committed Mar 4, 2024
2 parents ffb9352 + 2d4deb1 commit dcb5718
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/Hangfire.PostgreSql/Scripts/Install.v22.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SET search_path = 'hangfire';

DO $$
BEGIN
IF EXISTS(SELECT 1 FROM "schema" WHERE "version"::integer >= 22) THEN
RAISE EXCEPTION 'version-already-applied';
END IF;
END $$;

DROP INDEX IF EXISTS jobqueue_queue_fetchat_jobId;
CREATE INDEX IF NOT EXISTS ix_hangfire_jobqueue_fetchedat_queue_jobid ON jobqueue USING btree (fetchedat nulls first, queue, jobid);

RESET search_path;
4 changes: 2 additions & 2 deletions tests/Hangfire.PostgreSql.Tests/PostgreSqlInstallerFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void InstallingSchemaUpdatesVersionAndShouldNotThrowAnException()
PostgreSqlObjectsInstaller.Install(connection, schemaName);
int lastVersion = connection.Query<int>($@"SELECT version FROM ""{schemaName}"".""schema""").Single();
Assert.Equal(21, lastVersion);
Assert.Equal(22, lastVersion);
connection.Execute($@"DROP SCHEMA ""{schemaName}"" CASCADE;");
});
Expand All @@ -39,7 +39,7 @@ public void InstallingSchemaWithCapitalsUpdatesVersionAndShouldNotThrowAnExcepti
PostgreSqlObjectsInstaller.Install(connection, schemaName);
int lastVersion = connection.Query<int>($@"SELECT version FROM ""{schemaName}"".""schema""").Single();
Assert.Equal(21, lastVersion);
Assert.Equal(22, lastVersion);
connection.Execute($@"DROP SCHEMA ""{schemaName}"" CASCADE;");
});
Expand Down

0 comments on commit dcb5718

Please sign in to comment.