Skip to content

Commit 7a45186

Browse files
committed
Better document flow and reasoning for initial non-poll operation
1 parent 8866d81 commit 7a45186

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

osu.Server.QueueProcessor/BeatmapStatusWatcher.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,34 @@ public static class BeatmapStatusWatcher
1818
/// <summary>
1919
/// Start a background task which will poll for beatmap sets with updates.
2020
/// </summary>
21+
/// <remarks>
22+
/// Prior to polling, a blocking call to <see cref="GetUpdatedBeatmapSets"/> is required to ensure no initial updates are missed.
23+
/// The general flow of usage should be:
24+
///
25+
/// // before doing anything else
26+
/// var updates = await GetUpdatedBeatmapSets();
27+
/// // can now query and cache beatmaps.
28+
/// StartPolling(updates, callback);
29+
///
30+
/// void callback(BeatmapUpdates u)
31+
/// {
32+
/// foreach (int id in u.BeatmapSetIDs)
33+
/// {
34+
/// // invalidate `id`
35+
/// }
36+
/// }
37+
/// </remarks>
38+
/// <param name="initialUpdates">The response from an initial call to <see cref="GetUpdatedBeatmapSets"/>.</param>
2139
/// <param name="callback">A callback to receive information about any updated beatmap sets.</param>
2240
/// <param name="pollMilliseconds">The number of milliseconds to wait between polls. Starts counting from response of previous poll.</param>
2341
/// <param name="limit">The maximum number of beatmap sets to return in a single response.</param>
2442
/// <returns>An <see cref="IDisposable"/> that should be disposed of to stop polling.</returns>
25-
public static IDisposable StartPolling(Action<BeatmapUpdates> callback, int pollMilliseconds = 10000, int limit = 50) =>
43+
public static IDisposable StartPolling(BeatmapUpdates initialUpdates, Action<BeatmapUpdates> callback, int pollMilliseconds = 10000, int limit = 50) =>
2644
new PollingBeatmapStatusWatcher(callback, pollMilliseconds, limit);
2745

2846
/// <summary>
2947
/// Check for any beatmap sets with updates since the provided queue ID.
30-
/// Should be called on a regular basis. See <see cref="StartPolling"/> for automatic polling.
48+
/// Should be called on a regular basis. See <see cref="StartPolling"/> for automatic polling after the first call.
3149
/// </summary>
3250
/// <param name="lastQueueId">The last checked queue ID, ie <see cref="BeatmapUpdates.LastProcessedQueueID"/>.</param>
3351
/// <param name="limit">The maximum number of beatmap sets to return in a single response.</param>

0 commit comments

Comments
 (0)