Search Results for

    Show / Hide Table of Contents
    View Source

    Class DistributedLockTimeoutExtensions

    Extension methods for expressing the timeout a distributed lock waits for as a database command timeout.

    Inheritance
    object
    Namespace: Umbraco.Cms.Infrastructure.Persistence
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public static class DistributedLockTimeoutExtensions

    Methods

    View Source

    ToLockCommandTimeoutSeconds(TimeSpan)

    Converts the timeout a distributed lock waits for to the whole number of seconds that the statement obtaining it should run under.

    Declaration
    public static int ToLockCommandTimeoutSeconds(this TimeSpan lockTimeout)
    Parameters
    Type Name Description
    TimeSpan lockTimeout

    The timeout the lock waits for.

    Returns
    Type Description
    int

    The command timeout in whole seconds.

    Remarks

    Allows a margin on top of the lock timeout, so that a mechanism able to report a lock timeout of its own gets to do so before the client abandons the command. Rounds up, so that a sub-second timeout cannot become zero seconds - which providers read as no limit at all.

    The result is a function of the lock's own wait alone, deliberately independent of any ambient command timeout: a lock statement reads or writes a single row, so a longer configured timeout buys it nothing, and a shorter one would stop it waiting as asked.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX