wpilibsuite / allwpilib

Official Repository of WPILibJ and WPILibC
https://wpilib.org/
Other
1.03k stars 606 forks source link

Closing NetworkTables publisher doesn't flush queued data #6737

Open brettle opened 3 weeks ago

brettle commented 3 weeks ago

Describe the question you have. Consider the following code:

try (var publisher = topic.publish()) {
    publisher.set(value);
}

Shouldn't remote subscribers (eventually) see the new value? My testing seems to indicate that they might not see it unless inst.flushLocal() (or inst.flush()) is called before the publisher is (auto-)closed. That seems to hold independent of any PubSubOptions associated with the publisher or whether the topic is cached . Is that intentional?

Describe the reason for your confusion. The current behavior was just not what I expected. If it is intentional, it should probably be better documented.

PeterJohnson commented 3 weeks ago

It used to, but I think the transmit changes made in #5659 are likely what causes these to be lost now.

brettle commented 3 weeks ago

Is this considered a bug or was it considered a necessary part of #5659?

PeterJohnson commented 3 weeks ago

I consider it to be a bug.