Skip to content

Commit

Permalink
Cleanup pending transfers and deliveries on link detach (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 authored May 12, 2024
1 parent 89ab8ca commit 994c6a8
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 176 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ jobs:
- stable
- nightly

name: ${{ matrix.version }} - x86_64-apple-darwin
name: ${{ matrix.version }} - aarch64-apple-darwin
runs-on: macOS-latest

steps:
- uses: actions/checkout@master

- name: Install ${{ matrix.version }}
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.version }}-x86_64-apple-darwin
toolchain: ${{ matrix.version }}-aarch64-apple-darwin
profile: minimal
override: true

- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
- name: Cache cargo registry
uses: actions/cache@v4
with:
command: generate-lockfile
path: ~/.cargo/registry
key: ${{ matrix.version }}-aarch64-apple-darwin-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Cache Dependencies
uses: Swatinem/[email protected]
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ matrix.version }}-aarch64-apple-darwin-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}

- name: Run tests
uses: actions-rs/cargo@v1
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [2.1.7] - 2024-05-12

* Cleanup pending transfers and deliveries on link detach

## [codec-0.9.4] - 2024-04-30

* Add Variant::Array() type
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-amqp"
version = "2.1.6"
version = "2.1.7"
authors = ["ntex contributors <[email protected]>"]
description = "AMQP 1.0 Client/Server framework"
documentation = "https://docs.rs/ntex-amqp"
Expand Down Expand Up @@ -28,7 +28,7 @@ ntex = "1"
ntex-util = "1.0.1"
ntex-amqp-codec = "0.9"

bitflags = "2.4"
bitflags = "2"
derive_more = "0.99"
log = "0.4"
pin-project-lite = "0.2"
Expand Down
28 changes: 19 additions & 9 deletions codec/src/codec/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,11 @@ fn datetime_from_millis(millis: i64) -> Result<DateTime<Utc>, AmqpParseError> {

#[cfg(test)]
mod tests {
use chrono::TimeDelta;
use ntex_bytes::{BufMut, BytesMut};

use super::*;
use crate::codec::{Decode, Encode};
use ntex_bytes::{BufMut, BytesMut};

const LOREM: &str = include_str!("lorem.txt");

Expand Down Expand Up @@ -675,10 +677,12 @@ mod tests {
#[test]
fn test_timestamp() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
let datetime =
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
datetime.encode(&mut b1);

let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
let expected =
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
assert_eq!(
expected,
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
Expand All @@ -688,10 +692,12 @@ mod tests {
#[test]
fn test_timestamp_pre_unix() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
let datetime =
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
datetime.encode(&mut b1);

let expected = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
let expected =
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
assert_eq!(
expected,
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
Expand Down Expand Up @@ -747,10 +753,12 @@ mod tests {
#[test]
fn variant_timestamp() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
let datetime =
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
Variant::Timestamp(datetime).encode(&mut b1);

let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
let expected =
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
assert_eq!(
Variant::Timestamp(expected),
unwrap_value(Variant::decode(&mut b1.freeze()))
Expand All @@ -760,10 +768,12 @@ mod tests {
#[test]
fn variant_timestamp_pre_unix() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
let datetime =
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
Variant::Timestamp(datetime).encode(&mut b1);

let expected = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
let expected =
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
assert_eq!(
Variant::Timestamp(expected),
unwrap_value(Variant::decode(&mut b1.freeze()))
Expand Down
Loading

0 comments on commit 994c6a8

Please sign in to comment.