-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIChannelEditPacer.cs
More file actions
19 lines (18 loc) · 993 Bytes
/
Copy pathIChannelEditPacer.cs
File metadata and controls
19 lines (18 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace RustPlusBot.Discord.Posting;
/// <summary>
/// Spaces out our own message edits to a channel so a burst never exhausts Discord's per-channel
/// edit bucket (which otherwise makes Discord.Net preemptively throttle the tail of the burst and
/// log a rate-limit warning). Shared process-wide, so every writer to a channel is paced against
/// the same clock.
/// </summary>
public interface IChannelEditPacer
{
/// <summary>
/// Reserves the next edit slot for the channel and, if that slot is in the future, waits until it
/// is due. Call immediately before editing; the first edit to an idle channel returns at once.
/// </summary>
/// <param name="channelId">The Discord channel the edit targets.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>A task that completes when the caller may send its edit.</returns>
Task PaceAsync(ulong channelId, CancellationToken cancellationToken);
}