Skip to content

Commit 994c6a8

Browse files
authored
Cleanup pending transfers and deliveries on link detach (#52)
1 parent 89ab8ca commit 994c6a8

File tree

11 files changed

+231
-176
lines changed

11 files changed

+231
-176
lines changed

.github/workflows/osx.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,30 @@ jobs:
1111
- stable
1212
- nightly
1313

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

1717
steps:
1818
- uses: actions/checkout@master
1919

2020
- name: Install ${{ matrix.version }}
21-
uses: actions-rs/toolchain@v1
21+
uses: actions-rust-lang/setup-rust-toolchain@v1
2222
with:
23-
toolchain: ${{ matrix.version }}-x86_64-apple-darwin
23+
toolchain: ${{ matrix.version }}-aarch64-apple-darwin
2424
profile: minimal
2525
override: true
2626

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

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

3539
- name: Run tests
3640
uses: actions-rs/cargo@v1

CHANGES.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changes
22

3+
## [2.1.7] - 2024-05-12
4+
5+
* Cleanup pending transfers and deliveries on link detach
6+
37
## [codec-0.9.4] - 2024-04-30
48

59
* Add Variant::Array() type

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ntex-amqp"
3-
version = "2.1.6"
3+
version = "2.1.7"
44
authors = ["ntex contributors <[email protected]>"]
55
description = "AMQP 1.0 Client/Server framework"
66
documentation = "https://docs.rs/ntex-amqp"
@@ -28,7 +28,7 @@ ntex = "1"
2828
ntex-util = "1.0.1"
2929
ntex-amqp-codec = "0.9"
3030

31-
bitflags = "2.4"
31+
bitflags = "2"
3232
derive_more = "0.99"
3333
log = "0.4"
3434
pin-project-lite = "0.2"

codec/src/codec/decode.rs

+19-9
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,11 @@ fn datetime_from_millis(millis: i64) -> Result<DateTime<Utc>, AmqpParseError> {
542542

543543
#[cfg(test)]
544544
mod tests {
545+
use chrono::TimeDelta;
546+
use ntex_bytes::{BufMut, BytesMut};
547+
545548
use super::*;
546549
use crate::codec::{Decode, Encode};
547-
use ntex_bytes::{BufMut, BytesMut};
548550

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

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

681-
let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
684+
let expected =
685+
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
682686
assert_eq!(
683687
expected,
684688
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
@@ -688,10 +692,12 @@ mod tests {
688692
#[test]
689693
fn test_timestamp_pre_unix() {
690694
let mut b1 = BytesMut::with_capacity(0);
691-
let datetime = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
695+
let datetime =
696+
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
692697
datetime.encode(&mut b1);
693698

694-
let expected = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
699+
let expected =
700+
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
695701
assert_eq!(
696702
expected,
697703
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
@@ -747,10 +753,12 @@ mod tests {
747753
#[test]
748754
fn variant_timestamp() {
749755
let mut b1 = BytesMut::with_capacity(0);
750-
let datetime = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
756+
let datetime =
757+
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
751758
Variant::Timestamp(datetime).encode(&mut b1);
752759

753-
let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
760+
let expected =
761+
Utc.with_ymd_and_hms(2011, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
754762
assert_eq!(
755763
Variant::Timestamp(expected),
756764
unwrap_value(Variant::decode(&mut b1.freeze()))
@@ -760,10 +768,12 @@ mod tests {
760768
#[test]
761769
fn variant_timestamp_pre_unix() {
762770
let mut b1 = BytesMut::with_capacity(0);
763-
let datetime = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
771+
let datetime =
772+
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
764773
Variant::Timestamp(datetime).encode(&mut b1);
765774

766-
let expected = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);
775+
let expected =
776+
Utc.with_ymd_and_hms(1968, 7, 26, 18, 21, 3).unwrap() + TimeDelta::milliseconds(521);
767777
assert_eq!(
768778
Variant::Timestamp(expected),
769779
unwrap_value(Variant::decode(&mut b1.freeze()))

0 commit comments

Comments
 (0)