Exemple #1
0
        internal static async Task <Transaction> CreateTransactionWithRetryAsync(this KeyValueStoreReplica kvsStore, IExceptionHandlingPolicy exceptionPolicy, CancellationToken token)
        {
            // TODO:
            // There's currently a bug in KVS where a service gets identified as a primary but doesn't actually have KVS write access.
            // Retrying solves the issue until the bug gets solved.
            while (!token.IsCancellationRequested)
            {
                try
                {
                    return(kvsStore.CreateTransaction());
                }
                catch (Exception e)
                {
                    exceptionPolicy.ReportError(e, false);

                    await Task.Delay(Constants.KvsCreateTransactionRetryTime, token);
                }
            }

            return(null);
        }
Exemple #2
0
 public SewingSession(KeyValueStoreReplica store)
 {
     this.store = store;
     tx         = store.CreateTransaction();
 }