Skip to content

Improvement: Make COM API support timeouts #242

@artemsheinacn

Description

@artemsheinacn

What

@bharatGoswami8 @darkwisebear
It seems COM API at the moment is not compatible with timeouts, for example using a subscription like this:

futures::executor::block_on(tokio::time::timeout(timeout.into(), scheduler_input.receive()))

with receive:

pub async fn receive(&mut self) -> MwComSample<'a, T> {
        let mut sample_container = self
            .subscription
            .receive(self.sample_container.take().expect("concurrent receive calls detected on the same subscription"), 1, 1)
            .await
            .unwrap();
        let result = sample_container.pop_front().unwrap();
        self.sample_container = Some(sample_container);
        result
    }

In this case subscription.receive call consumes the sample container and in case if timeout is triggered and the receive future is dropped there is no way to get the sample container back. I think it should provide some kind of into_inner method, so I can reuse the sample container, or better provide some kind of a helper type abstracting out a need to be dealing with sample container manually and providing a clean way to convert a subscription and a sample container into a stream.

How

No response

Estimates for realization

8h

Category

  • Affects Detailed Design

Requirements / Architecture

  • Requirements / Architecture are not affected by this change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions