Ejemplo n.º 1
0
        public async ValueTask ExecuteAsync(IConsole console)
        {
            console.GetCancellationToken().Register(() => Log.Information("Cancellation requested"));
            var options = new UpdateOptions {
                Actions  = Actions?.UnJoin('|'),
                Channels = Channels?.UnJoin('|'),
                Parts    = Parts?.UnJoin('|').Select(p => p.ParseEnum <CollectPart>()).ToArray(),
                Tables   = Tables?.UnJoin('|'),
                Results  = Results?.UnJoin('|'),
                Indexes  = Indexes?.UnJoin('|'),
                FullLoad = FullLoad,
                DisableChannelDiscover = DisableChannelDiscover,
                SearchConditions       = SearchConditions?.UnJoin('|').Select(t => {
                    var(index, condition, _) = t.UnJoin(':');
                    return(index, condition);
                }).ToArray(),
                SearchIndexes      = SearchIndexes?.UnJoin('|'),
                UserScrapeInit     = UserScrapeInit,
                UserScrapeTrial    = UserScrapeTrial,
                UserScrapeAccounts = UserScrapeAccounts?.UnJoin('|')
            };

            await PipeCtx.Run((YtUpdater u) => u.Update(options, PipeArg.Inject <CancellationToken>()),
                              new PipeRunOptions { Location = Location, Exclusive = true }, Log, console.GetCancellationToken());
        }
    }