logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class AchievementSyncBackoff

    The schedule the platform-sync retry runs on: a fixed interval that doubles on every failed attempt, up to a ceiling, and snaps back to the base interval on the first success.

    Inheritance
    object
    AchievementSyncBackoff
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Achievements.Application.Services
    Assembly: Serenity.Achievements.Application.dll
    Syntax
    public class AchievementSyncBackoff
    Remarks

    Engine-free and side-effect free on purpose. The Unity runner owns "when a frame happened" and "what an attempt does"; everything about "is an attempt due, and how long until the next one" lives here, where a test can pin it without a play-mode loop.

    The ceiling matters more than the growth: a storefront client that is simply not installed never comes up, and an unbounded retry would settle into one pointless call per frame-hour forever. Eight times the base interval keeps a client that DOES come up minutes later within a few minutes of being noticed.

    Constructors

    AchievementSyncBackoff(double, int)

    Initializes a new instance of the AchievementSyncBackoff class.

    Declaration
    public AchievementSyncBackoff(double baseIntervalSeconds, int maximumMultiplier = 8)
    Parameters
    Type Name Description
    double baseIntervalSeconds

    Seconds between attempts while they succeed. Zero or less disables the schedule.

    int maximumMultiplier

    How many times the base interval the delay may grow to. Below one is treated as one.

    Fields

    DefaultMaximumMultiplier

    The default ceiling: the interval never grows past eight times the base.

    Declaration
    public const int DefaultMaximumMultiplier = 8
    Field Value
    Type Description
    int

    Properties

    CurrentIntervalSeconds

    How long the current wait is, in seconds.

    Declaration
    public double CurrentIntervalSeconds { get; }
    Property Value
    Type Description
    double

    CurrentMultiplier

    The factor the base interval is currently multiplied by.

    Declaration
    public int CurrentMultiplier { get; }
    Property Value
    Type Description
    int

    IsEnabled

    Whether a retry schedule is configured at all.

    Declaration
    public bool IsEnabled { get; }
    Property Value
    Type Description
    bool

    Methods

    Advance(double)

    Adds elapsed time and answers whether an attempt is due, consuming the interval when it is.

    Declaration
    public bool Advance(double deltaSeconds)
    Parameters
    Type Name Description
    double deltaSeconds

    Seconds elapsed since the last call. Negative values are ignored.

    Returns
    Type Description
    bool

    true when the caller should attempt a sync now; otherwise false.

    ReportFailure()

    Reports that the attempt failed, doubling the interval up to the ceiling.

    Declaration
    public void ReportFailure()

    ReportSuccess()

    Reports that the attempt succeeded, restoring the base interval.

    Declaration
    public void ReportSuccess()
    In this article
    © 2026 Serenity. All Rights Reserved