tractor icon indicating copy to clipboard operation
tractor copied to clipboard

Add a @pub kwarg to allow specifying a "startup response message"

Open goodboy opened this issue 4 years ago • 1 comments

This is a fix for an (old and) undocumented feature that enabled async generator based "pub-sub" streaming such that during stream connection startup an initial "message" is sent to each new subscriber much like how the new tractor.Context.started() works for bidirectional streaming setup.

This patch in particular was pulled out of historical work on the infect_asyncio branch.

I'm not even sure this undocumented internal "pub sub" api should even be kept since it is basically just a multiplexed (read non-task oriented) version of what you can already do easily with our task-broadcast receiver apis and a single producer actor.

It's probably worth making a so called dynamic pub-sub example using the newer APIs for comparision, maybe do some brief perf benchmarks and then decide if we should just drop this interface?

goodboy avatar Nov 01 '21 16:11 goodboy

I'm thinking we should do a rewrite of this using the new bi-dir streaming + MsgStream.subscribe() apis and completely drop this internal subsystem.

goodboy avatar Dec 27 '21 01:12 goodboy