Skip to content

Blocking calls in kafta tests #129

Open
@Arooba-git

Description

@Arooba-git

HI! 🙂

Thank you for this project.

As we were going through the source , we found these blocking calls in AbstractIT class of the Kafka.it tests:
vsb2-blocking

This method is called in another method where a timed await is called immediately after calling the above (sendToTopic) method:
Screen Shot 2023-07-24 at 6 19 48 PM

Which got us thinking , if we are waiting anyway, then why use .block operator and block the event loop.. Would it not be just fine to subscribe? 🤔 We tried the test cases with subscribe() and they still passed..

We also evaluated the performance difference when using block vs subscribe (in terms of thread count and heap usage), and the subscribe version seem to outperform in both.

I know this is just test code but considering many users are and will be using it for their project, we might as well set good example by avoiding blocking calls wherever possible in a reactive chain/event loop.

We created a PR with the change in case you deem it fit: #130 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions