Esempio n. 1
0
        static async Task BeginRecoverReadOnlyLoop(FasterLog log, CancellationToken cancellationToken)
        {
            while (!cancellationToken.IsCancellationRequested)
            {
                // Delay for a while before checking again.
                await Task.Delay(TimeSpan.FromMilliseconds(restorePeriodMs), cancellationToken);

                await log.RecoverReadOnlyAsync(cancellationToken);
            }
        }
Esempio n. 2
0
        static async Task BeginRecoverAsyncLoop(FasterLog log, CancellationToken cancellationToken)
        {
            try
            {
                while (!cancellationToken.IsCancellationRequested)
                {
                    // Delay for a while before checking again.
                    await Task.Delay(TimeSpan.FromMilliseconds(restorePeriodMs), cancellationToken);

                    Console.WriteLine("Restoring Separate Log...");

                    // Recover to the last commit by the primary FasterLog instance.
                    await log.RecoverReadOnlyAsync(cancellationToken);
                }
            }
            catch (OperationCanceledException) { }
            Console.WriteLine("RecoverAsyncLoop complete");
        }