You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0aafc93
Browse filesBrowse the repository at this point in the historyBrowse files
Rename Extensions to RxExtensions, clarify FromEventBuffered's bufferSize risk (#2)
Extensions read too generically for a class this specific to RxSharp's own combinators.
RxExtensions in the existing RxSharp.Extras namespace keeps the same one-name-for-the-
whole-surface benefit without the genericness.
Also expanded the bufferSize doc comment on FromEventBuffered: the default of 1 is a
real footgun for a caller filtering for a specific match among payloads that could
plausibly arrive in the pre-subscribe gap this method exists to cover - a matching
payload can be silently evicted by a later non-matching one before anyone subscribes.
Found via a puppeteer-sharp code review on the two call sites doing exactly that
(WaitForTargetAsync/WaitForFrameAsync), which are being fixed to pass a larger
bufferSize as a follow-up in that repo.
Claude-Session: https://claude.ai/code/session_01K92eapPm8e7mX7puT4cF4s
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: src/RxSharp/Extras/FromCancellationToken.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
namespaceRxSharp.Extras;
2
2
3
3
/// <summary>Puppeteer-flavored combinators built on top of the core primitives — the C# analogues of the helpers Puppeteer itself layers on top of rxjs (see CLAUDE.md's "Puppeteer-essential surface").</summary>
4
-
publicstaticpartialclassExtensions
4
+
publicstaticpartialclassRxExtensions
5
5
{
6
6
/// <summary>
7
7
/// An observable that never emits and errors as soon as <paramref name="cancellationToken"/> is cancelled.
/// <summary>Extension methods providing an eagerly-attached, buffered variant of <see cref="Observable.FromEvent{TEventArgs}"/>.</summary>
45
-
publicstaticpartialclassExtensions
45
+
publicstaticpartialclassRxExtensions
46
46
{
47
47
/// <summary>
48
48
/// Like <see cref="Observable.FromEvent{TDelegate, TEventArgs}"/>, but attaches the underlying event handler
@@ -68,7 +68,14 @@ public static partial class Extensions
68
68
/// <param name="addHandler">Called immediately, with the handler to add to the event.</param>
69
69
/// <param name="removeHandler">Called on <see cref="BufferedEventSource{TEventArgs}.Dispose"/>, with the same handler, to remove it from the event.</param>
70
70
/// <param name="conversion">Converts an <see cref="Action{TEventArgs}"/> callback into the event's actual delegate shape.</param>
71
-
/// <param name="bufferSize">The maximum number of most-recent payloads kept for replay. Defaults to 1.</param>
71
+
/// <param name="bufferSize">
72
+
/// The maximum number of most-recent payloads kept for replay. Defaults to 1 - fine if the caller only
73
+
/// cares about the single most recent payload, but a real risk if the caller filters for a specific match
74
+
/// among possibly-several payloads that could arrive in the pre-subscribe gap this method exists to cover:
75
+
/// with the default of 1, a matching payload can be silently evicted from the buffer by a later
76
+
/// non-matching one before anyone subscribes to see it. Pass a larger value whenever more than one payload
77
+
/// could plausibly arrive before subscription and only some of them are what the caller is looking for.
78
+
/// </param>
72
79
/// <returns>A handle exposing the buffered payloads as an observable, and detaching the handler on disposal.</returns>
@@ -86,7 +93,14 @@ public static BufferedEventSource<TEventArgs> FromEventBuffered<TDelegate, TEven
86
93
/// <typeparam name="TEventArgs">The type of the event's payload.</typeparam>
87
94
/// <param name="addHandler">Called immediately, with the handler to add to the event.</param>
88
95
/// <param name="removeHandler">Called on <see cref="BufferedEventSource{TEventArgs}.Dispose"/>, with the same handler, to remove it from the event.</param>
89
-
/// <param name="bufferSize">The maximum number of most-recent payloads kept for replay. Defaults to 1.</param>
96
+
/// <param name="bufferSize">
97
+
/// The maximum number of most-recent payloads kept for replay. Defaults to 1 - fine if the caller only
98
+
/// cares about the single most recent payload, but a real risk if the caller filters for a specific match
99
+
/// among possibly-several payloads that could arrive in the pre-subscribe gap this method exists to cover:
100
+
/// with the default of 1, a matching payload can be silently evicted from the buffer by a later
101
+
/// non-matching one before anyone subscribes to see it. Pass a larger value whenever more than one payload
102
+
/// could plausibly arrive before subscription and only some of them are what the caller is looking for.
103
+
/// </param>
90
104
/// <returns>A handle exposing the buffered payloads as an observable, and detaching the handler on disposal.</returns>
Copy file name to clipboardExpand all lines: src/RxSharp/Extras/RetryAndRaceWithSignalAndTimer.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
namespaceRxSharp.Extras;
4
4
5
5
/// <summary>Extension methods composing retry, cancellation, and timeout into the single combinator Puppeteer's <c>Locator</c> actions rely on.</summary>
6
-
publicstaticpartialclassExtensions
6
+
publicstaticpartialclassRxExtensions
7
7
{
8
8
/// <summary>
9
9
/// The combinator behind Puppeteer's <c>Locator</c> actions (click/fill/hover/wait): retry the source
@@ -13,7 +13,7 @@ public static partial class Extensions
13
13
/// that may not have rendered yet") while still giving up promptly, either because the caller cancelled it
14
14
/// or because it took longer than <paramref name="timeout"/> — whichever happens first. Since the cancellation
15
15
/// and timeout branches are <see cref="Observable{T}"/> sources that only ever error (see
16
-
/// <see cref="Extensions.FromCancellationToken"/> and <see cref="Extensions.Timeout"/>), the only way
16
+
/// <see cref="RxExtensions.FromCancellationToken"/> and <see cref="RxExtensions.Timeout"/>), the only way
17
17
/// this combinator produces a value is if the retried <paramref name="source"/> itself emits one before either
18
18
/// branch fires.
19
19
/// </summary>
@@ -23,7 +23,7 @@ public static partial class Extensions
23
23
/// <param name="causeFactory">
24
24
/// Produces the exception used for both the cancellation and timeout branches. Defaults to
25
25
/// <see cref="OperationCanceledException"/> for cancellation and <see cref="TimeoutException"/> for the timeout,
26
-
/// via the defaults of <see cref="Extensions.FromCancellationToken"/> and <see cref="Extensions.Timeout"/> respectively.
26
+
/// via the defaults of <see cref="RxExtensions.FromCancellationToken"/> and <see cref="RxExtensions.Timeout"/> respectively.
27
27
/// </param>
28
28
/// <param name="retryDelay">The delay between retry attempts. Defaults to 50 milliseconds.</param>
29
29
/// <param name="cancellationToken">A token that, when cancelled, aborts the whole operation immediately.</param>
0 commit comments