Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/inflight_activation_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ impl InflightActivationStore {
FROM inflight_taskactivations
WHERE status = $2
AND (deadletter_at IS NULL OR deadletter_at > $3)
ORDER BY added_at
LIMIT 1
)
RETURNING *",
Expand Down Expand Up @@ -628,6 +629,23 @@ mod tests {
assert_count_by_status(&store, InflightActivationStatus::Pending, 1).await;
}

#[tokio::test]
async fn test_get_pending_activation_earliest() {
let url = generate_temp_filename();
let store = InflightActivationStore::new(&url).await.unwrap();

let mut batch = make_activations(2);
batch[0].added_at = Utc.with_ymd_and_hms(2024, 6, 24, 0, 0, 0).unwrap();
batch[1].added_at = Utc.with_ymd_and_hms(1998, 6, 24, 0, 0, 0).unwrap();
assert!(store.store(batch.clone()).await.is_ok());

let result = store.get_pending_activation().await.unwrap().unwrap();
assert_eq!(
result.added_at,
Utc.with_ymd_and_hms(1998, 6, 24, 0, 0, 0).unwrap()
);
}

#[tokio::test]
async fn test_count_pending_activations() {
let url = generate_temp_filename();
Expand Down
Loading