tokahuke / yaque

Yaque is yet another disk-backed persistent queue for Rust.
Other
79 stars 11 forks source link

Can't recv an empty message #27

Closed mullr closed 8 months ago

mullr commented 8 months ago

Here's a failing test case:

    #[test]
    fn test_try_recv_empty_msg() {
        // Populate a queue:
        let mut sender = SenderBuilder::new()
            .segment_size(512)
            .open("data/try-recv-empty-msg")
            .unwrap();

        sender.try_send(&[]).unwrap();

        let mut receiver = Receiver::open("data/try-recv-empty-msg").unwrap();

        let item = receiver.try_recv().unwrap();
        assert_eq!(&*item, &[]);
        item.commit().unwrap();
    }

The actual behavior is that try_recv returns Err(TryRecvError::QueueEmpty)

tokahuke commented 8 months ago

Makes sense! Let's add this to a new minor release of your PR.

tokahuke commented 8 months ago

Merged and published!