Add tap-> that returns the value

Description

tap> returns whether the put was successful. Another variant that would often be useful is a threaded tap-> that returns the value.

Options: For backpressure case (tap queue is full) there are options:

  • wait and retry - seems like waiting would potentially alter your program in bad ways just to tap

  • assert tap> succeeded (so assertion throws if full) - you will then know about this case, but it also alters the behavior of your program with an assertion error which seems bad.

  • do nothing, ignore tap> result - if tap queue is full, values will be silently dropped

Proposed: Seems like default should be to not affect running program, so chose the last option, ignoring the tap> result and dropping in case of full tap queue.

Patch: clj-2538-2.patch

Screened By: fogus

Environment

None

Attachments

3

Activity

Show:

Alex Miller January 14, 2022 at 1:16 PM

Decided this is not worth doing - just wrap in `doto` as the patch does.

Alex Miller January 13, 2022 at 4:00 PM

Rebased to master and added tests

Michael Fogus October 12, 2021 at 12:58 PM

are there any useful tests that could be added for this?

Declined

Details

Assignee

Reporter

Labels

Patch

Code

Priority

Affects versions

Created October 22, 2019 at 11:52 PM
Updated January 14, 2022 at 1:16 PM
Resolved January 14, 2022 at 1:16 PM