Task queue pagination by anchor
This commit is contained in:
@@ -16,6 +16,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
|
||||
- Invalidate caches when group memberships change on an external directory.
|
||||
- Return OIDC errors instead of "failed to decode token".
|
||||
- User impersonation.
|
||||
- Task queue pagination by anchor.
|
||||
- Log viewer: All events show as `INFO`.
|
||||
- Registry: Allow changing object variants.
|
||||
- Node id renewal.
|
||||
|
||||
@@ -457,13 +457,7 @@ pub(crate) async fn task_query(
|
||||
_ => false,
|
||||
})?;
|
||||
|
||||
if let Some(anchor) = req.request.anchor {
|
||||
let anchor = anchor.id();
|
||||
if anchor > due_from {
|
||||
due_from = anchor;
|
||||
}
|
||||
}
|
||||
|
||||
let anchor_id = req.request.anchor.map(|anchor| anchor.id());
|
||||
if req
|
||||
.request
|
||||
.sort
|
||||
@@ -480,6 +474,24 @@ pub(crate) async fn task_query(
|
||||
.request
|
||||
.extract_parameters(req.server.core.jmap.query_max_results, None)?;
|
||||
|
||||
let mut from_id = 0u64;
|
||||
if let Some(anchor_id) = anchor_id
|
||||
&& let Some(anchor_task) = req
|
||||
.server
|
||||
.store()
|
||||
.get_value::<Task>(ValueKey::from(ValueClass::TaskQueue(
|
||||
TaskQueueClass::Task { id: anchor_id },
|
||||
)))
|
||||
.await
|
||||
.caused_by(trc::location!())?
|
||||
{
|
||||
let anchor_due = anchor_task.due_timestamp();
|
||||
if anchor_due >= due_from && anchor_due <= due_to {
|
||||
due_from = anchor_due;
|
||||
from_id = anchor_id;
|
||||
}
|
||||
}
|
||||
|
||||
// Build response
|
||||
let mut response = QueryResponseBuilder::new(
|
||||
req.server.core.jmap.query_max_results + 1,
|
||||
@@ -489,9 +501,8 @@ pub(crate) async fn task_query(
|
||||
);
|
||||
|
||||
let mut total = 0;
|
||||
|
||||
let from_key = ValueKey::from(ValueClass::TaskQueue(TaskQueueClass::Due {
|
||||
id: 0,
|
||||
id: from_id,
|
||||
due: due_from,
|
||||
}));
|
||||
let to_key = ValueKey::from(ValueClass::TaskQueue(TaskQueueClass::Due {
|
||||
|
||||
Reference in New Issue
Block a user