// TODO: Add port public async Task <Result> StartServer(IModset modset, CancellationToken cancellationToken) { return(await ShutdownServer( Port, false, cancellationToken) //.Bind(() => _modsUpdateService.UpdateModset(modset, cancellationToken)) .Bind(() => _serverProvider.GetServer(Port, modset).Start())); }
public override void Process(IList <SearchSource> item) { Recorder.Trace(4L, TraceType.InfoTrace, "ServerLookup.Process Item:", item); item.FirstOrDefault <SearchSource>(); IList <SearchSource> list = new List <SearchSource>(); Func <SearchSource, string> func = delegate(SearchSource source) { if (source.MailboxInfo.IsRemoteMailbox) { return(null); } if (source.MailboxInfo.IsArchive) { return(source.MailboxInfo.ArchiveDatabase.ToString()); } return(source.MailboxInfo.MdbGuid.ToString()); }; foreach (SearchSource searchSource in item) { string text = func(searchSource); GroupId groupId; if (!string.IsNullOrEmpty(text) && this.TaskContext.LookupCache.TryGetValue(text, out groupId)) { Recorder.Trace(4L, TraceType.InfoTrace, "ServerLookup.Process Cache Hit GroupId:", groupId); base.Executor.EnqueueNext(new FanoutParameters { GroupId = groupId, Source = searchSource }); } else { list.Add(searchSource); } } if (list.Count > 0) { Recorder.Trace(4L, TraceType.InfoTrace, "ServerLookup.Process Cache Misses Count:", list.Count); IServerProvider serverProvider = SearchFactory.Current.GetServerProvider(base.Policy); foreach (FanoutParameters fanoutParameters in serverProvider.GetServer(base.Policy, list)) { if (fanoutParameters.GroupId != null && fanoutParameters.GroupId.Uri != null && fanoutParameters.GroupId.GroupType != GroupType.SkippedError) { string text2 = func(fanoutParameters.Source); if (!string.IsNullOrEmpty(text2)) { this.TaskContext.LookupCache.TryAdd(text2, fanoutParameters.GroupId); } base.Executor.EnqueueNext(fanoutParameters); } else { Recorder.Trace(4L, TraceType.InfoTrace, "ServerLookup.Process Ignoring an recipient group:", fanoutParameters.GroupId); } } } }
public async Task <IActionResult> GetServerStatus(int port = 2302) { var server = _serverProvider.GetServer(port); var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); var serverStatus = server is null ? new ServerStatus() : await server.GetServerStatusAsync(cancellationTokenSource.Token); return(Ok(serverStatus)); }
/// <inheritdoc /> public Task StartAsync(CancellationToken cancellationToken) { RecurringJob.AddOrUpdate <MaintenanceService>(x => x.PerformMaintenance(CancellationToken.None), Cron.Daily(4)); // Initialize provider // TODO: Find a better way Task.Run(() => { Task.Delay(TimeSpan.FromSeconds(5), cancellationToken); return(_ = _serverProvider.GetServer(2302)); }, cancellationToken); return(Task.CompletedTask); }