AutoId limit: login is a transition, inventory capped at 5 sends a second
A client crashed at login inside AC's CreateObject handling during the login create burst, 47 s after start, while pack items were being appraised at about 30 a second. Pack appraisals now stay out of that burst. - Login-complete counts as a transition. LoginLifecycleHooks.LoginCompleteAtMs (0 before login and after a logout; a hot reload marks it at the reload). Container and Inventory appraisals wait until 30 s after the later of login-complete and the last settle window (AutoIdPolicy.TransitionEndMs), and are deferred while login has not completed. A container opened after that point is still not deferred. The selected target is exempt. - Inventory sends are capped at one per 200 ms (5 a second; AutoIdPolicy.InventoryRateAllows, Verdict.WaitRate). Limited mode only; containers, the target and All mode are not capped. - "rate" skip counter in /rc autoid and the per-minute line. Tests: login defer (before, at, through and after login-complete; later-of with a portal; the opened-container exemption; target exempt), the inventory rate (interval boundary and a simulated drain never exceeding 5 in any second while reaching 5), the decision table with the rate input. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
aaaa0a94b4
commit
44765436cd
4 changed files with 166 additions and 44 deletions
|
|
@ -22,9 +22,12 @@
|
|||
// or in a side pack) that have no cached appraisal.
|
||||
// Container and Inventory wait until the object is MinAgeMs old, and until
|
||||
// DeferMs after a world transition's settle window ends (death, portal,
|
||||
// teleport, landblock jump; walking into the next landblock is not one).
|
||||
// A container the player opened after that settle window ended is not
|
||||
// deferred. Creatures, ground items, other players: never.
|
||||
// teleport, landblock jump; walking into the next landblock is not one),
|
||||
// and until DeferMs after login completes (login is a transition too:
|
||||
// a client crashed in AC's CreateObject handling during the
|
||||
// login create burst). A container the player opened after the last
|
||||
// transition ended is not deferred. Inventory sends are capped at 5 a
|
||||
// second. Creatures, ground items, other players: never.
|
||||
// Off nothing, the selected target included.
|
||||
// Plugins calling the host RequestId are not limited by any of this.
|
||||
//
|
||||
|
|
@ -46,9 +49,17 @@ internal static class AutoIdPolicy
|
|||
/// <summary>Container and Inventory appraisals wait until the object is this old.</summary>
|
||||
public const long MinAgeMs = 2_000;
|
||||
|
||||
/// <summary>Container and Inventory appraisals wait this long after a transition's settle window ends.</summary>
|
||||
/// <summary>Container and Inventory appraisals wait this long after a transition's settle window ends,
|
||||
/// and after login completes.</summary>
|
||||
public const long DeferMs = 30_000;
|
||||
|
||||
/// <summary>
|
||||
/// Inventory appraisals go out at most one per this many ms (5 a second). In one case
|
||||
/// a client crashed in AC's CreateObject handling during the login create burst, 47 s after
|
||||
/// start, and the pack's appraisals at 30 a second are what that burst must not carry.
|
||||
/// </summary>
|
||||
public const long InventoryMinIntervalMs = 200;
|
||||
|
||||
public enum Class
|
||||
{
|
||||
/// <summary>The selected target (the priority path).</summary>
|
||||
|
|
@ -75,6 +86,8 @@ internal static class AutoIdPolicy
|
|||
WaitDefer,
|
||||
/// <summary>Its appraisal is cached (fresh): drop it.</summary>
|
||||
SkipFresh,
|
||||
/// <summary>Inventory over its send rate (InventoryMinIntervalMs): keep it and ask again later.</summary>
|
||||
WaitRate,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -85,9 +98,10 @@ internal static class AutoIdPolicy
|
|||
/// settle window ended (<see cref="OpenedAfterSettle"/>), which exempts it from the defer.
|
||||
/// <paramref name="fresh"/>: its appraisal is cached and recent (Target, Container).
|
||||
/// <paramref name="cached"/>: its appraisal is cached at all (Inventory).
|
||||
/// <paramref name="inventoryRateOk"/>: Inventory only, the send rate allows one now (<see cref="InventoryRateAllows"/>).
|
||||
/// </summary>
|
||||
public static Verdict Decide(AutoIdMode mode, Class cls, long ageMs, bool inDefer, bool openedAfterSettle,
|
||||
bool fresh, bool cached)
|
||||
bool fresh, bool cached, bool inventoryRateOk = true)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
|
|
@ -114,6 +128,7 @@ internal static class AutoIdPolicy
|
|||
if (cached) return Verdict.SkipFresh;
|
||||
if (ageMs < MinAgeMs) return Verdict.WaitAge;
|
||||
if (inDefer) return Verdict.WaitDefer;
|
||||
if (!inventoryRateOk) return Verdict.WaitRate;
|
||||
return Verdict.Send;
|
||||
case Class.Unknown:
|
||||
// Its place shows up in the snapshot within a tick or two; until it is
|
||||
|
|
@ -126,17 +141,30 @@ internal static class AutoIdPolicy
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inside the post-transition defer: in a transition now, or less than <see cref="DeferMs"/>
|
||||
/// after the last settle window ended. <paramref name="settleUntilMs"/> is
|
||||
/// WorldTransitionState.SettleUntilMs (0 = no transition yet); it only moves on a death,
|
||||
/// a portal, a teleport or a landblock jump, never on a walk into the next landblock.
|
||||
/// When the last transition ended: the later of the settle window's end
|
||||
/// (WorldTransitionState.SettleUntilMs, 0 = none yet; it only moves on a death, a portal,
|
||||
/// a teleport or a landblock jump, never on a walk into the next landblock) and login
|
||||
/// completing (<paramref name="loginCompleteAtMs"/>; login counts as a transition).
|
||||
/// </summary>
|
||||
public static bool InDefer(long nowMs, long settleUntilMs, bool inTransition) =>
|
||||
inTransition || (settleUntilMs > 0 && nowMs < settleUntilMs + DeferMs);
|
||||
public static long TransitionEndMs(long settleUntilMs, long loginCompleteAtMs) =>
|
||||
Math.Max(settleUntilMs, loginCompleteAtMs);
|
||||
|
||||
/// <summary>The player opened the container (at <paramref name="openedAtMs"/>) after the last settle window ended.</summary>
|
||||
public static bool OpenedAfterSettle(long openedAtMs, long settleUntilMs) =>
|
||||
openedAtMs > 0 && openedAtMs >= settleUntilMs;
|
||||
/// <summary>
|
||||
/// Inside the defer: in a transition now, login not complete yet
|
||||
/// (<paramref name="loginCompleteAtMs"/> 0: the login create burst), or less than
|
||||
/// <see cref="DeferMs"/> after <see cref="TransitionEndMs"/>.
|
||||
/// </summary>
|
||||
public static bool InDefer(long nowMs, long settleUntilMs, long loginCompleteAtMs, bool inTransition) =>
|
||||
inTransition || loginCompleteAtMs <= 0 || nowMs < TransitionEndMs(settleUntilMs, loginCompleteAtMs) + DeferMs;
|
||||
|
||||
/// <summary>The player opened the container (at <paramref name="openedAtMs"/>) after the last transition ended
|
||||
/// (<paramref name="transitionEndMs"/>, <see cref="TransitionEndMs"/>).</summary>
|
||||
public static bool OpenedAfterSettle(long openedAtMs, long transitionEndMs) =>
|
||||
openedAtMs > 0 && openedAtMs >= transitionEndMs;
|
||||
|
||||
/// <summary>An Inventory appraisal may go out now: none yet, or the last was at least InventoryMinIntervalMs ago.</summary>
|
||||
public static bool InventoryRateAllows(long nowMs, long lastInventorySendMs) =>
|
||||
lastInventorySendMs <= 0 || nowMs - lastInventorySendMs >= InventoryMinIntervalMs;
|
||||
|
||||
/// <summary>
|
||||
/// Where an object is, from its PublicWeenieDesc ownership fields (<paramref name="known"/> =
|
||||
|
|
|
|||
Loading…
Reference in a new issue