public async Task <bool> TryStartUpdateSession(string applicationId) { using (IUpdateBlob updateBlob = await _updateBlobFactory.TryLockUpdateBlob(applicationId)) { string updateDomain = updateBlob.GetUpdateDomain(); if (string.IsNullOrEmpty(updateDomain) || _instanceUpdateDomain == updateDomain) { updateDomain = _instanceUpdateDomain; Trace.TraceInformation( $"Instance {_instanceId} will attempt to start update session for " + $"ApplicationId = {applicationId}, UpdateDomain = {updateDomain}"); updateBlob.SetUpdateDomain(updateDomain); updateBlob.AddInstance(_instanceId); await updateBlob.FlushAndRelease(); Trace.TraceInformation( $"Instance {_instanceId} successfully started the update session for " + $"ApplicationId = {applicationId}, UpdateDomain = {updateDomain}"); return(true); } } return(false); }
public Task <IUpdateBlob> TryLockUpdateBlob(string appId) { return(_retryPolicy.ExecuteAsync(() => _updateBlobFactory.TryLockUpdateBlob(appId))); }