mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 11:21:24 +00:00
Index on queue_time for job queue, limit to 10 jobs in ID query
This commit is contained in:
parent
0fd6c459d0
commit
6514487ea9
2 changed files with 12 additions and 0 deletions
|
@ -1191,6 +1191,7 @@ impl QueueRepo for PostgresRepo {
|
|||
.and(queue_alias.field(queue).eq(queue_name)),
|
||||
)
|
||||
.order(queue_alias.field(queue_time))
|
||||
.limit(10)
|
||||
.for_update()
|
||||
.skip_locked()
|
||||
.single_value();
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
use barrel::backend::Pg;
|
||||
use barrel::{types, Migration};
|
||||
|
||||
pub(crate) fn migration() -> String {
|
||||
let mut m = Migration::new();
|
||||
|
||||
m.inject_custom("CREATE INDEX queue_time_index ON job_queue (queue_time);");
|
||||
m.inject_custom("DROP INDEX queue_status_index;");
|
||||
|
||||
m.make::<Pg>().to_string()
|
||||
}
|
Loading…
Reference in a new issue